blob: 054bb7095187ce4ab417c8e5b1484ef350470839 [file] [log] [blame]
<script src="../resources/js-test.js"></script>
<p id="p" style="width: 10em;">
This paragraph contains two lines of text.
<p id="description"></p>
<pre id="tree"></pre>
<div id="console"></div>
description("Tests that accessible inline text boxes update when a static text node changes.");
if (window.accessibilityController) {
window.jsTestIsAsync = true;
window.axParagraph = accessibilityController.accessibleElementById('p');
window.axStaticText = axParagraph.childAtIndex(0);
shouldBe("axStaticText.childrenCount", "2");
window.axInlineBefore0 = axStaticText.childAtIndex(0);
shouldBe("", "'This paragraph contains '");
window.axInlineBefore1 = axStaticText.childAtIndex(1);
shouldBe("", "'two lines of text.'");
// Modify the text.
document.getElementById("p").innerText += ' One more sentence.';
// Wait for a notification on the element before checking the new state.
axStaticText.addNotificationListener(function(notification) {
// Make sure the inline text boxes changed.
shouldBe("axStaticText.childrenCount", "3");
window.axInlineAfter0 = axStaticText.childAtIndex(0);
shouldBe("", "'This paragraph contains '");
window.axInlineAfter1 = axStaticText.childAtIndex(1);
shouldBe("", "'two lines of text. One '");
window.axInlineAfter2 = axStaticText.childAtIndex(2);
shouldBe("", "'more sentence.'");
// Make sure the old object pointing to the second text box is no longer valid.
shouldBe("", "''");