Skip to content

Commit

Permalink
test pressed charCode also for keydown event
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Oct 23, 2022
1 parent f038a14 commit cfb0a8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/Js/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ public function testKeyboardEvents($modifier, $eventProperties)
$event = $webAssert->elementExists('css', '.elements .text-event');

$input1->keyDown('u', $modifier);
$this->assertEquals('key downed:'.$eventProperties, $event->getText());
$this->assertEquals('key downed: 117 / ' . $eventProperties, $event->getText());

$input2->keyPress('r', $modifier);
$this->assertEquals('key pressed:114 / '.$eventProperties, $event->getText());
$this->assertEquals('key pressed: 114 / ' . $eventProperties, $event->getText());

$input3->keyUp(78, $modifier);
$this->assertEquals('key upped:78 / '.$eventProperties, $event->getText());
$this->assertEquals('key upped: 78 / ' . $eventProperties, $event->getText());
}

public function provideKeyboardEventsModifiers()
Expand Down
6 changes: 3 additions & 3 deletions web-fixtures/js_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@
});

$('.elements input.input.first').keydown(function(ev) {
$('.text-event').text('key downed:' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1);
$('.text-event').text('key downed: ' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1);
});

$('.elements input.input.second').keypress(function(ev) {
$('.text-event').text('key pressed:' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1);
$('.text-event').text('key pressed: ' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1);
});

$('.elements input.input.third').keyup(function(ev) {
$('.text-event').text('key upped:' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1);
$('.text-event').text('key upped: ' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1);
});

$( "#draggable" ).draggable();
Expand Down

0 comments on commit cfb0a8c

Please sign in to comment.