Problem/Motivation
AjaxFormImageButtonTest now extends WebDriverTestBase instead of JavascriptTestBase. There's a TODO item which was waiting for this change.
#2942900: Convert JavascriptTestBase Tests to use DrupalSelenium2Driver
JavascriptTestBase is deprecated in favor of WebDriverTestBase
Keypress events weren't reliable with the PhantomJS driver, so the workaround was to trigger keypress events using \Behat\Mink\Session::executeScript()
. This workaround is no longer needed, now that we're using the Selenium driver.
Note, this class only tests that the button responds to the enter key. However buttons are expected to respond when either the enter or space key is pressed. Let's cover this situation too. It's common to see faux-buttons like this in the wild:
<a href="#" role="button" onclick="foo()">Edit</a>
The button role tells screen readers to announce it as a button, yet it doesn't behave like a button because it can't be activated by the space key. That's a bug we can guard against by testing both keys.
Proposed resolution
- Replace the executeScript workaround. Find the button, and use a keyPress event.
Replicate the ENTER key press test, so we test the SPACE key behaviour too.DEFERRED to #3030363: Add test to assert ajax buttons are operable with the enter key..