You are here

public function EventsTest::testKeyboardEvents in Zircon Profile 8.0

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

@dataProvider provideKeyboardEventsModifiers

File

vendor/behat/mink/driver-testsuite/tests/Js/EventsTest.php, line 91

Class

EventsTest

Namespace

Behat\Mink\Tests\Driver\Js

Code

public function testKeyboardEvents($modifier, $eventProperties) {
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/js_test.html'));
  $webAssert = $this
    ->getAssertSession();
  $input1 = $webAssert
    ->elementExists('css', '.elements input.input.first');
  $input2 = $webAssert
    ->elementExists('css', '.elements input.input.second');
  $input3 = $webAssert
    ->elementExists('css', '.elements input.input.third');
  $event = $webAssert
    ->elementExists('css', '.elements .text-event');
  $input1
    ->keyDown('u', $modifier);
  $this
    ->assertEquals('key downed:' . $eventProperties, $event
    ->getText());
  $input2
    ->keyPress('r', $modifier);
  $this
    ->assertEquals('key pressed:114 / ' . $eventProperties, $event
    ->getText());
  $input3
    ->keyUp(78, $modifier);
  $this
    ->assertEquals('key upped:78 / ' . $eventProperties, $event
    ->getText());
}