blob: f5ab0a8d8207671c7807ecfbecacd540b61475a0 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<!-- Suspected "a" element in several different configurations. -->
<div>
<a id="id1" href="x" style="display:block;">
<span style="display:block;">one</span>
</a>
</div>
<div>
<div>before</div>
<a id="id2" href="x" style="display:block;">
<span style="display:block;">two</span>
</a>
</div>
<a id="id3" href="x" style="display:block;"><span style="display:block;">three</span></a>
<div>
<a id="id4" href="x" style="display:block;">
before,
<span style="display:block;">four</span>
,after
</a>
</div>
<div>
<div>before</div>
<a id="id5" href="x" style="display:block;"><span style="display:block;">five</span>
,after
</a>
</div>
<a id="id6" href="x" style="display:block;">before,<span style="display:block;">six</span></a>
<a id="id7" href="x" style="display:block;">no span here</a>
<div id="console"></div>
<script>
var caretMovedData;
function stripNonWhite(s)
{
var s2 = "";
var i;
for(i = 0; i < s.length; i++)
if (s[i] != ' ' && s[i] != '\n')
s2 += s[i];
return s2.replace(/<\\n>/g, "");
}
function globalListener(object, name, offset)
{
var role = object.role.replace('AXRole: AX', '');
if (name == 'AXTextCaretMoved') {
caretMovedData += role + '|' + offset;
}
}
function setCaretOffset(accessibleText, offset)
{
return accessibleText.setSelectedTextRange(offset, 0);
}
if (window.internals)
internals.settings.setCaretBrowsingEnabled(true);
if (window.testRunner)
testRunner.dumpAsText();
if (window.accessibilityController) {
var i, linkText, accText, id;
accessibilityController.addNotificationListener(globalListener)
for (i = 1; i <= 7; i++) {
id = 'id' + i;
elem = accessibilityController.accessibleElementById(id);
linkText = stripNonWhite(document.links[id].textContent);
accText = stripNonWhite(elem.stringValue);
shouldBeEqualToString("accText", "AXValue:" + linkText);
caretMovedData = '';
shouldBe("setCaretOffset(elem, 1)", "true");
shouldBeEqualToString("caretMovedData", "Link|1");
}
}
description('This tests that text inside "a" block inside "span" block is accessible.');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>