diff --git a/tests/Js/EventsTest.php b/tests/Js/EventsTest.php index f06999b..3e3a618 100644 --- a/tests/Js/EventsTest.php +++ b/tests/Js/EventsTest.php @@ -56,6 +56,15 @@ public function testFocus() $focusBlurDetector->focus(); $this->assertEquals('focused', $focusBlurDetector->getValue()); + + $focusableAnchor = $this->getAssertSession()->elementExists('css', '.elements a#focusable'); + $this->assertEquals('no action detected', $focusableAnchor->getText()); + + $focusableAnchor->focus(); + // checking that we're on same page + $this->getAssertSession()->addressEquals('/js_test.html'); + $this->assertEquals('focused', $focusableAnchor->getText()); + } /** @@ -68,6 +77,8 @@ public function testBlur() $focusBlurDetector = $this->getAssertSession()->elementExists('css', '.elements input#focus-blur-detector'); $this->assertEquals('no action detected', $focusBlurDetector->getValue()); + // focusing before, because blur won't be triggered if HTMLElement is not focused + $focusBlurDetector->focus(); $focusBlurDetector->blur(); $this->assertEquals('blured', $focusBlurDetector->getValue()); } diff --git a/web-fixtures/js_test.html b/web-fixtures/js_test.html index 6285455..afbe233 100644 --- a/web-fixtures/js_test.html +++ b/web-fixtures/js_test.html @@ -30,6 +30,7 @@
+ no action detected