| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 | 7 |
| 8 <p id="p" style="width: 10em;"> | 8 <p id="p" style="width: 10em;"> |
| 9 This paragraph contains two lines of text. | 9 This paragraph contains two lines of text. |
| 10 </p> | 10 </p> |
| 11 | 11 |
| 12 <p id="description"></p> | 12 <p id="description"></p> |
| 13 <pre id="tree"></pre> | 13 <pre id="tree"></pre> |
| 14 <div id="console"></div> | 14 <div id="console"></div> |
| 15 | 15 |
| 16 <script> | 16 <script> |
| 17 | 17 |
| 18 description("Tests that accessible inline text boxes update when a static te
xt node changes."); | 18 description("Tests that accessible inline text boxes update when a static te
xt node changes."); |
| 19 | 19 |
| 20 var notificationCalled = false; |
| 21 |
| 20 if (window.accessibilityController) { | 22 if (window.accessibilityController) { |
| 21 testRunner.waitUntilDone(); | 23 testRunner.waitUntilDone(); |
| 22 window.jsTestIsAsync = true; | 24 window.jsTestIsAsync = true; |
| 23 | 25 |
| 24 window.axParagraph = accessibilityController.accessibleElementById('p'); | 26 window.axParagraph = accessibilityController.accessibleElementById('p'); |
| 25 window.axStaticText = axParagraph.childAtIndex(0); | 27 window.axStaticText = axParagraph.childAtIndex(0); |
| 26 shouldBe("axStaticText.childrenCount", "2"); | 28 shouldBe("axStaticText.childrenCount", "2"); |
| 27 | 29 |
| 28 window.axInlineBefore0 = axStaticText.childAtIndex(0); | 30 window.axInlineBefore0 = axStaticText.childAtIndex(0); |
| 29 shouldBe("axInlineBefore0.name", "'This paragraph contains '"); | 31 shouldBe("axInlineBefore0.name", "'This paragraph contains '"); |
| 30 window.axInlineBefore1 = axStaticText.childAtIndex(1); | 32 window.axInlineBefore1 = axStaticText.childAtIndex(1); |
| 31 shouldBe("axInlineBefore1.name", "'two lines of text.'"); | 33 shouldBe("axInlineBefore1.name", "'two lines of text.'"); |
| 32 | 34 |
| 33 // Modify the text. | 35 // Modify the text. |
| 34 document.getElementById("p").innerText += ' One more sentence.'; | 36 document.getElementById("p").innerText += ' One more sentence.'; |
| 35 | 37 |
| 36 // Wait for a notification on the element before checking the new state. | 38 // Wait for a notification on the element before checking the new state. |
| 37 axStaticText.addNotificationListener(function(notification) { | 39 axStaticText.addNotificationListener(function(notification) { |
| 40 // The notification might be called before or after the document |
| 41 // load event. This test allows either cases and ignore subsequent |
| 42 // notifications after the first notification. |
| 43 if (notificationCalled) { |
| 44 return; |
| 45 } |
| 38 // Make sure the inline text boxes changed. | 46 // Make sure the inline text boxes changed. |
| 39 shouldBe("axStaticText.childrenCount", "3"); | 47 shouldBe("axStaticText.childrenCount", "3"); |
| 40 window.axInlineAfter0 = axStaticText.childAtIndex(0); | 48 window.axInlineAfter0 = axStaticText.childAtIndex(0); |
| 41 shouldBe("axInlineAfter0.name", "'This paragraph contains '"); | 49 shouldBe("axInlineAfter0.name", "'This paragraph contains '"); |
| 42 window.axInlineAfter1 = axStaticText.childAtIndex(1); | 50 window.axInlineAfter1 = axStaticText.childAtIndex(1); |
| 43 shouldBe("axInlineAfter1.name", "'two lines of text. One '"); | 51 shouldBe("axInlineAfter1.name", "'two lines of text. One '"); |
| 44 window.axInlineAfter2 = axStaticText.childAtIndex(2); | 52 window.axInlineAfter2 = axStaticText.childAtIndex(2); |
| 45 shouldBe("axInlineAfter2.name", "'more sentence.'"); | 53 shouldBe("axInlineAfter2.name", "'more sentence.'"); |
| 46 | 54 |
| 47 // Make sure the old object pointing to the second text box is no lo
nger valid. | 55 // Make sure the old object pointing to the second text box is no lo
nger valid. |
| 48 shouldBe("axInlineBefore1.name", "''"); | 56 shouldBe("axInlineBefore1.name", "''"); |
| 57 |
| 58 notificationCalled = true; |
| 49 finishJSTest(); | 59 finishJSTest(); |
| 50 }); | 60 }); |
| 51 } | 61 } |
| 52 </script> | 62 </script> |
| 53 | 63 |
| 54 </body> | 64 </body> |
| 55 </html> | 65 </html> |
| OLD | NEW |