зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1111815 - adding accessibility checks for isElementDisplayed. r=dburns
--- .../marionette/tests/unit/test_accessibility.py | 19 +++++++++++++++++++ .../client/marionette/www/test_accessibility.html | 1 + testing/marionette/marionette-listener.js | 4 +++- 3 files changed, 23 insertions(+), 1 deletion(-)
This commit is contained in:
Родитель
a0d80c56ab
Коммит
324a4c1410
|
@ -48,6 +48,13 @@ class TestAccessibility(MarionetteTestCase):
|
|||
"button10"
|
||||
]
|
||||
|
||||
displayed_elementIDs = [
|
||||
"button1", "button2", "button3", "button4", "button5", "button6",
|
||||
"button9", "no_accessible_but_displayed"
|
||||
]
|
||||
|
||||
displayed_but_a11y_hidden_elementIDs = ["button7", "button8"]
|
||||
|
||||
def run_element_test(self, ids, testFn):
|
||||
for id in ids:
|
||||
element = self.marionette.find_element("id", id)
|
||||
|
@ -107,3 +114,15 @@ class TestAccessibility(MarionetteTestCase):
|
|||
self.run_element_test(self.falsy_elements,
|
||||
lambda button: self.assertRaises(ElementNotVisibleException,
|
||||
button.click))
|
||||
|
||||
def test_element_visible_but_not_visible_to_accessbility(self):
|
||||
self.setup_accessibility()
|
||||
# Elements are displayed but hidden from accessibility API
|
||||
self.run_element_test(self.displayed_but_a11y_hidden_elementIDs,
|
||||
lambda element: self.assertRaises(ElementNotAccessibleException,
|
||||
element.is_displayed))
|
||||
|
||||
def test_element_is_visible_to_accessibility(self):
|
||||
self.setup_accessibility()
|
||||
# No exception should be raised
|
||||
self.run_element_test(self.displayed_elementIDs, lambda element: element.is_displayed())
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
<button id="button10" style="visibility:hidden;">
|
||||
button10
|
||||
</button>
|
||||
<span id="no_accessible_but_displayed">I have no accessible object</span>
|
||||
<script>
|
||||
document.getElementById('button5').addEventListener('click', function() {
|
||||
// A pseudo button that has a listener but is missing button semantics.
|
||||
|
|
|
@ -1551,7 +1551,9 @@ function isElementDisplayed(msg) {
|
|||
let command_id = msg.json.command_id;
|
||||
try {
|
||||
let el = elementManager.getKnownElement(msg.json.id, curFrame);
|
||||
sendResponse({value: utils.isElementDisplayed(el)}, command_id);
|
||||
let displayed = utils.isElementDisplayed(el);
|
||||
checkVisibleAccessibility(accessibility.getAccessibleObject(el), displayed);
|
||||
sendResponse({value: displayed}, command_id);
|
||||
}
|
||||
catch (e) {
|
||||
sendError(e.message, e.code, e.stack, command_id);
|
||||
|
|
Загрузка…
Ссылка в новой задаче