Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / text-change-notification.html
blob3d294618e8a64ce42f1ed4de175bc4f8fec5b5e2
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 </head>
6 <body>
8 <div id="container">
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>
16 </div>
18 <div id="console"></div>
19 <script>
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() {
32 successCount++;
33 if (successCount != 4)
34 return;
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;
43 finishJSTest();
46 accessibleElementById('aria-label').addNotificationListener(function(notification) {
47 debug('Got ' + notification + ' notification on aria-label');
48 gotSuccessfulNotification();
49 });
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();
55 });
56 document.getElementById('title').title = 'New title';
58 accessibleElementById('labelledby').addNotificationListener(function(notification) {
59 debug('Got ' + notification + ' notification on labelledby');
60 gotSuccessfulNotification();
61 });
62 document.getElementById('labelledby').setAttribute('aria-labelledby', 'label2');
64 accessibleElementById('labeled').addNotificationListener(function(notification) {
65 debug('Got ' + notification + ' notification on labeled');
66 gotSuccessfulNotification();
67 });
68 document.getElementById('label1').setAttribute('for', 'labeled');
70 debug('');
73 </script>
75 </body>
76 </html>