forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccessibility-object-detached.html
33 lines (26 loc) · 1.07 KB
/
accessibility-object-detached.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
<!DOCTYPE HTML>
<html>
<body>
<script src="../resources/js-test-pre.js"></script>
<canvas id="canvas"></canvas>
<div id="console"></div>
<script>
description("This test makes sure that AccessibilityObjects are detached when the node they point to is detached.");
if (window.testRunner && window.accessibilityController) {
window.testRunner.dumpAsText();
// Create a button on the page, focus it and get its accessibility role.
var button = document.createElement('button');
document.body.appendChild(button);
button.focus();
window.axElement = accessibilityController.focusedElement;
window.expectedButtonRole = axElement.role;
// Now remove the node from the tree and get the role of the detached accessibility object.
// We detect that it's detached just by checking that the role is different (empty or unknown).
document.body.removeChild(button);
window.expectedDetachedRole = axElement.role;
shouldBeTrue("expectedButtonRole != expectedDetachedRole");
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>