4 <script src=
"../resources/js-test.js"></script>
9 <button id=
"aria-label" aria-label=
"Aria Label">Content
</button>
10 <button id=
"title" title=
"Title">Content
</button>
11 <button id=
"labelledby" aria-labelledby=
"label1">Content
</button>
12 <button id=
"labeled">Content
</button>
14 <label id=
"label1">Label1
</label>
15 <label id=
"label2">Label2
</label>
18 <div id=
"console"></div>
20 description("This test ensures that a change to an element's accessible text, even if indirect, sends a notification.");
21 window
.jsTestIsAsync
= true;
23 if (window
.testRunner
&& window
.accessibilityController
) {
24 testRunner
.dumpAsText();
26 function accessibleElementById(id
) {
27 return accessibilityController
.accessibleElementById(id
);
30 window
.successCount
= 0;
31 function gotSuccessfulNotification() {
33 if (successCount
!= 4)
36 debug('All notifications received successfully.');
37 accessibleElementById('aria-label').removeNotificationListener();
38 accessibleElementById('title').removeNotificationListener();
39 accessibleElementById('labelledby').removeNotificationListener();
40 accessibleElementById('labeled').removeNotificationListener();
42 document
.getElementById('container').hidden
= true;
46 accessibleElementById('aria-label').addNotificationListener(function(notification
) {
47 debug('Got ' + notification
+ ' notification on aria-label');
48 gotSuccessfulNotification();
50 document
.getElementById('aria-label').setAttribute('aria-label', 'New aria-label');
52 accessibleElementById('title').addNotificationListener(function(notification
) {
53 debug('Got ' + notification
+ ' notification on title');
54 gotSuccessfulNotification();
56 document
.getElementById('title').title
= 'New title';
58 accessibleElementById('labelledby').addNotificationListener(function(notification
) {
59 debug('Got ' + notification
+ ' notification on labelledby');
60 gotSuccessfulNotification();
62 document
.getElementById('labelledby').setAttribute('aria-labelledby', 'label2');
64 accessibleElementById('labeled').addNotificationListener(function(notification
) {
65 debug('Got ' + notification
+ ' notification on labeled');
66 gotSuccessfulNotification();
68 document
.getElementById('label1').setAttribute('for', 'labeled');