blob: 69b98748efb55d4e85b8e55e9c53b965f3859f0b [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body>
<p id="p" style="width: 10em;">
This paragraph contains two lines of text.
</p>
<p id="description"></p>
<pre id="tree"></pre>
<div id="console"></div>
<script>
description("Tests that accessible inline text boxes update when a static text node changes.");
var notificationCalled = false;
if (window.accessibilityController) {
testRunner.waitUntilDone();
window.jsTestIsAsync = true;
window.axParagraph = accessibilityController.accessibleElementById('p');
window.axStaticText = axParagraph.childAtIndex(0);
shouldBe("axStaticText.childrenCount", "2");
window.axInlineBefore0 = axStaticText.childAtIndex(0);
shouldBe("axInlineBefore0.name", "'This paragraph contains '");
window.axInlineBefore1 = axStaticText.childAtIndex(1);
shouldBe("axInlineBefore1.name", "'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) {
// The notification might be called before or after the document
// load event. This test allows either cases and ignore subsequent
// notifications after the first notification.
if (notificationCalled) {
return;
}
// Make sure the inline text boxes changed.
shouldBe("axStaticText.childrenCount", "3");
window.axInlineAfter0 = axStaticText.childAtIndex(0);
shouldBe("axInlineAfter0.name", "'This paragraph contains '");
window.axInlineAfter1 = axStaticText.childAtIndex(1);
shouldBe("axInlineAfter1.name", "'two lines of text. One '");
window.axInlineAfter2 = axStaticText.childAtIndex(2);
shouldBe("axInlineAfter2.name", "'more sentence.'");
// Make sure the old object pointing to the second text box is no longer valid.
shouldBe("axInlineBefore1.name", "''");
notificationCalled = true;
finishJSTest();
});
}
</script>
</body>
</html>