forked from burg/timelapse
/
visible-elements.html
40 lines (32 loc) · 1.33 KB
/
visible-elements.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<html>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
<body id="body">
<!-- This test ensures that a plugin that is not accessible, will not appear in the AX hierachy-->
<a href="#a">more</a><BR>
<div id="hiddenDiv" style="visibility: hidden; left: 0px; "><a href="#b">hello</a></div>
<div id="result"></div>
<script>
if (window.accessibilityController) {
var result = document.getElementById("result");
var body = document.getElementById("body");
body.focus();
var links1 = accessibilityController.focusedElement.attributesOfDocumentLinks();
// toggle the div
var divElement = document.getElementById("hiddenDiv");
divElement.style.visibility = "visible";
accessibilityController.focusedElement.attributesOfChildren();
var links2 = accessibilityController.focusedElement.attributesOfDocumentLinks();
if (links1 != links2) {
result.innerHTML += "PASS";
}
else {
result.innerHTML += "FAIL - The div's visibility was toggled, but the new link did not appear\n\n";
result.innerHTML += "Links1: " + links1 + "\n\nLinks2: " + links2 + "\n\n";
}
}
</script>
</body>
</html>