blob: 2a278bbddeff3d92ae34b5cc822daf353cbf6b44 [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<div id="root">
<div id="parent"> <!-- Will get aria-owns="2" -->
</div>
<div id="2" role="presentation">
<div id="3" role="button"></div>
<div id="4" role="button"></div>
</div>
</div>
<script>
'use strict';
test(function(t) {
const axParent = accessibilityController.accessibleElementById('parent');
const axRoot = accessibilityController.accessibleElementById('root');
assert_equals(axRoot.role, 'AXRole: AXGenericContainer');
// The presentational div is initially ignored.
assert_equals(axRoot.childrenCount, 3);
document.getElementById('parent').setAttribute('aria-owns', '2');
assert_equals(axParent.childrenCount, 1);
// `axRoot` should no longer own the presentational div and any of its
// contents.
assert_equals(axRoot.childrenCount, 1);
assert_equals(axRoot.childAtIndex(0).role, 'AXRole: AXGenericContainer');
assert_equals(axParent.childAtIndex(0).role, 'AXRole: AXPresentational');
}, 'Aria-owns cannot be fooled by pointing it at a presentational node.');
</script>