Chromium Code Reviews| Index: LayoutTests/accessibility/inert-node-is-hidden.html |
| diff --git a/LayoutTests/accessibility/inert-node-is-hidden.html b/LayoutTests/accessibility/inert-node-is-hidden.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..90725265256cbdf82b211f879469cd34c14baa36 |
| --- /dev/null |
| +++ b/LayoutTests/accessibility/inert-node-is-hidden.html |
| @@ -0,0 +1,44 @@ |
| +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| +<html> |
| +<head> |
| +<script src="../fast/js/resources/js-test-pre.js"></script> |
| +</head> |
| +<body id="body"> |
| +This content should not be exposed to AT when a modal dialog is open. |
| +<div> |
| +<input title="input" id="input" type="text"> |
| +</div> |
| +<dialog title="dialog" id="dialog">Howdy</dialog> |
| + |
| +<script> |
| +description("This tests that inert elements are not in the AT tree."); |
| + |
| +function treeContainsText(node, text) { |
| + if (node.stringValue.indexOf(text) > 0) |
| + return true; |
| + for (i = 0; i < node.childrenCount; i++) { |
| + if (treeContainsText(node.childAtIndex(i), text)) |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| +if (window.accessibilityController) { |
| + document.body.focus(); |
| + webArea = accessibilityController.focusedElement; |
| + |
| + shouldBeNonNull("accessibilityController.accessibleElementById('input')"); |
| + shouldBeTrue("treeContainsText(webArea, 'This content should not be exposed to AT when a modal dialog is open')"); |
|
dmazzoni
2013/10/30 23:32:22
A simpler way to test this is accessibilityControl
falken
2013/10/31 02:27:40
I wanted to ensure it works for an anon child of b
|
| + |
| + document.querySelector('dialog').showModal(); |
| + shouldBeNull("accessibilityController.accessibleElementById('input')"); |
| + shouldBeFalse("treeContainsText(webArea, 'This content should not be exposed to AT when a modal dialog is open')"); |
| + |
| + document.querySelector('dialog').close(); |
| + shouldBeNonNull("accessibilityController.accessibleElementById('input')"); |
| + shouldBeTrue("treeContainsText(webArea, 'This content should not be exposed to AT when a modal dialog is open')"); |
| +} |
| +</script> |
| +<script src="../fast/js/resources/js-test-post.js"></script> |
| +</body> |
| +</html> |