You are here

public function ChangeEventTest::testSetValueChangeEvent in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/behat/mink/driver-testsuite/tests/Js/ChangeEventTest.php \Behat\Mink\Tests\Driver\Js\ChangeEventTest::testSetValueChangeEvent()

@dataProvider setValueChangeEventDataProvider @group change-event-detector

File

vendor/behat/mink/driver-testsuite/tests/Js/ChangeEventTest.php, line 41

Class

ChangeEventTest
@group slow

Namespace

Behat\Mink\Tests\Driver\Js

Code

public function testSetValueChangeEvent($elementId, $valueForEmpty, $valueForFilled = '') {
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/element_change_detector.html'));
  $page = $this
    ->getSession()
    ->getPage();
  $input = $this
    ->findById($elementId);
  $this
    ->assertNull($page
    ->findById($elementId . '-result'));

  // Verify setting value, when control is initially empty.
  $input
    ->setValue($valueForEmpty);
  $this
    ->assertElementChangeCount($elementId, 'initial value setting triggers change event');
  if ($valueForFilled) {

    // Verify setting value, when control already has a value.
    $this
      ->findById('results')
      ->click();
    $input
      ->setValue($valueForFilled);
    $this
      ->assertElementChangeCount($elementId, 'value change triggers change event');
  }
}