gecko/accessible/tests/mochitest/tree/test_list.html

106 lines
2.5 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<title>HTML ul/li element tests</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript">
function listItemTree(aBulletText, aName, aSubtree)
{
var obj = {
role: ROLE_LISTITEM,
children: [
{
role: ROLE_STATICTEXT,
name: aBulletText
},
{
role: ROLE_TEXT_LEAF,
name: aName
}
]
};
if (aSubtree)
obj.children.push(aSubtree);
return obj;
}
function doTest()
{
var bulletText = String.fromCharCode(0x2022) + " ";
// list1
var accTree = {
role: ROLE_LIST,
children: [
new listItemTree(bulletText, "Oranges"),
new listItemTree(bulletText, "Apples"),
new listItemTree(bulletText, "Bananas")
]
};
testAccessibleTree("list1", accTree);
// list2
accTree = {
role: ROLE_LIST,
children: [
new listItemTree("1. ", "Oranges"),
new listItemTree("2. ", "Apples"),
new listItemTree("3. ", "Bananas", accTree)
]
};
testAccessibleTree("list2", accTree);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="Fix O(n^2) access to all the children of a container"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=342045">
Mozilla Bug 342045
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<ul id="list1">
<li id="li1">Oranges</li>
<li id="li2">Apples</li>
<li id="li3">Bananas</li>
</ul>
<ol id="list2">
<li id="li4">Oranges</li>
<li id="li5">Apples</li>
<li id="li6">Bananas<ul>
<li id="n_li4">Oranges</li>
<li id="n_li5">Apples</li>
<li id="n_li6">Bananas</li>
</ul>
</li>
</ol>
</body>
</html>