blob: e23c7384c58bb110fc423294aace0e65ca3e3d93 [file] [log] [blame]
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.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>
async_test((t) => {
var notificationCalled = false;
var axParagraph = accessibilityController.accessibleElementById('p');
var axStaticText = axParagraph.childAtIndex(0);
assert_equals(axStaticText.childrenCount, 2);
var axInlineBefore0 = axStaticText.childAtIndex(0);
assert_equals(, 'This paragraph contains ');
var axInlineBefore1 = axStaticText.childAtIndex(1);
assert_equals(, 'two lines of text.');
// Modify the text.
var p = document.getElementById("p"); = p.innerText + ' One more sentence.';
// Wait for a notification on the element before checking the new state.
axStaticText.addNotificationListener(t.step_func((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) {
// Make sure the inline text boxes changed.
assert_equals(axStaticText.childrenCount, 3);
var axInlineAfter0 = axStaticText.childAtIndex(0);
assert_equals(, 'This paragraph contains ');
var axInlineAfter1 = axStaticText.childAtIndex(1);
assert_equals(, 'two lines of text. One ');
var axInlineAfter2 = axStaticText.childAtIndex(2);
assert_equals(, 'more sentence.');
// Make sure the old object pointing to the second text box is no longer valid.
assert_equals(, '');
notificationCalled = true;
}, "Tests that accessible inline text boxes update when a static text node changes.");