Skip to content

Commit

Permalink
improving testFocus and testBlur
Browse files Browse the repository at this point in the history
- added test on anchor element
  • Loading branch information
oleg-andreyev committed Jan 8, 2019
1 parent 7abcb42 commit 6ceaeea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Js/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

}

/**
Expand All @@ -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());
}
Expand Down
1 change: 1 addition & 0 deletions web-fixtures/js_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<input class="input second" type="text" value="" />
<input class="input third" type="text" value="" />
<div class="text-event"></div>
<a href="index.html" id="focusable">no action detected</a>
</div>

<div id="draggable" class="ui-widget-content"></div>
Expand Down

0 comments on commit 6ceaeea

Please sign in to comment.