<!DOCTYPE HTML>
<html>
<body>
<script src="../resources/js-test.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) {
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>
</body>
</html>