2 <script src=
"../resources/testharness.js"></script>
3 <script src=
"../resources/testharnessreport.js"></script>
6 <ul id=
"future_parent" aria-owns=
"future_child"></ul>
10 async_test(function(t
) {
11 var axFutureParent
= accessibilityController
.accessibleElementById("future_parent");
12 assert_equals(axFutureParent
.childrenCount
, 0);
13 var listener = function(notification
) {
14 assert_equals(notification
, "ChildrenChanged");
15 assert_equals(axFutureParent
.childrenCount
, 1);
17 document
.getElementById("container1").style
.display
= "none";
18 axFutureParent
.removeNotificationListener(listener
);
21 axFutureParent
.addNotificationListener(listener
);
22 var futureParent
= document
.getElementById("future_parent");
23 var child
= document
.createElement("li");
24 child
.id
= "future_child";
25 futureParent
.parentElement
.appendChild(child
);
26 }, "A children changed notification is fired when an aria-owned child gets added to the tree.");
33 <li id=
"item1">Item
1</li>
38 async_test(function(t
) {
39 var axList1
= accessibilityController
.accessibleElementById("list1");
40 assert_equals(axList1
.childrenCount
, 0);
41 var listener = function(notification
) {
42 assert_equals(notification
, "ChildrenChanged");
43 assert_equals(axList1
.childrenCount
, 1);
45 axList1
.removeNotificationListener(listener
);
46 document
.getElementById("container2").style
.display
= "none";
49 axList1
.addNotificationListener(listener
);
51 var list1
= document
.getElementById("list1");
52 list1
.setAttribute("aria-owns", "item1");
53 }, "A children changed notification is fired when an aria-owned attribute is added to an element that causes it to reparent another element to become its child.");
57 <ul id=
"newlist1" aria-label=
"newlist1">
59 <ul id=
"newlist2" aria-label=
"newlist2">
60 <li id=
"newitem1">New Item
1</li>
65 async_test(function(t
) {
66 var axList1
= accessibilityController
.accessibleElementById("newlist1");
67 assert_equals(axList1
.childrenCount
, 0);
68 var axList2
= accessibilityController
.accessibleElementById("newlist2");
69 assert_equals(axList2
.childrenCount
, 1);
70 var listener = function(notification
) {
71 assert_equals(notification
, "ChildrenChanged");
72 assert_equals(axList2
.childrenCount
, 0);
74 axList2
.removeNotificationListener(listener
);
75 document
.getElementById("container3").style
.display
= "none";
78 axList2
.addNotificationListener(listener
);
80 var list1
= document
.getElementById("newlist1");
81 list1
.setAttribute("aria-owns", "newitem1");
82 assert_equals(axList1
.childrenCount
, 1);
83 assert_equals(axList2
.childrenCount
, 0);
84 }, "A children changed notification is fired on the old parent when one of its children gets reparented to another element due to aria-owns.");