accessible/tests/mochitest/tree/test_list.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/tree/test_list.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,247 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>HTML ul/li element tests</title>
     1.8 +  <link rel="stylesheet" type="text/css"
     1.9 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.10 +
    1.11 +  <script type="application/javascript"
    1.12 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +
    1.14 +  <script type="application/javascript"
    1.15 +          src="../common.js"></script>
    1.16 +  <script type="application/javascript"
    1.17 +          src="../role.js"></script>
    1.18 +
    1.19 +  <script type="application/javascript">
    1.20 +    function listItemTree(aBulletText, aName, aSubtree)
    1.21 +    {
    1.22 +      var obj = {
    1.23 +        role: ROLE_LISTITEM,
    1.24 +        children: [
    1.25 +          {
    1.26 +            role: ROLE_STATICTEXT,
    1.27 +            name: aBulletText
    1.28 +          },
    1.29 +          {
    1.30 +            role: ROLE_TEXT_LEAF,
    1.31 +            name: aName
    1.32 +          }
    1.33 +        ]
    1.34 +      };
    1.35 +
    1.36 +      if (aSubtree)
    1.37 +        obj.children.push(aSubtree);
    1.38 +
    1.39 +      return obj;
    1.40 +    }
    1.41 +
    1.42 +    function doTest()
    1.43 +    {
    1.44 +      // list1
    1.45 +      var discAccTree = {
    1.46 +        role: ROLE_LIST,
    1.47 +        children: [
    1.48 +          new listItemTree(kDiscBulletText, "Oranges"),
    1.49 +          new listItemTree(kDiscBulletText, "Apples"),
    1.50 +          new listItemTree(kDiscBulletText, "Bananas")
    1.51 +        ]
    1.52 +      };
    1.53 +
    1.54 +      testAccessibleTree("list1", discAccTree);
    1.55 +
    1.56 +      // list2
    1.57 +      var circleAccTree = {
    1.58 +        role: ROLE_LIST,
    1.59 +        children: [
    1.60 +          new listItemTree(kCircleBulletText, "Oranges"),
    1.61 +          new listItemTree(kCircleBulletText, "Apples"),
    1.62 +          new listItemTree(kCircleBulletText, "Bananas")
    1.63 +        ]
    1.64 +      };
    1.65 +
    1.66 +      testAccessibleTree("list2", circleAccTree);
    1.67 +
    1.68 +      // list3
    1.69 +      var squareAccTree = {
    1.70 +        role: ROLE_LIST,
    1.71 +        children: [
    1.72 +          new listItemTree(kSquareBulletText, "Oranges"),
    1.73 +          new listItemTree(kSquareBulletText, "Apples"),
    1.74 +          new listItemTree(kSquareBulletText, "Bananas")
    1.75 +        ]
    1.76 +      };
    1.77 +
    1.78 +      testAccessibleTree("list3", squareAccTree);
    1.79 +
    1.80 +      // list4
    1.81 +      var nestedAccTree = {
    1.82 +        role: ROLE_LIST,
    1.83 +        children: [
    1.84 +          new listItemTree("1. ", "Oranges"),
    1.85 +          new listItemTree("2. ", "Apples"),
    1.86 +          new listItemTree("3. ", "Bananas", circleAccTree)
    1.87 +        ]
    1.88 +      };
    1.89 +
    1.90 +      testAccessibleTree("list4", nestedAccTree);
    1.91 +
    1.92 +      // dl list
    1.93 +      var tree =
    1.94 +        { DEFINITION_LIST: [ // dl
    1.95 +          { TERM: [ // dt
    1.96 +            { TEXT_LEAF: [] },
    1.97 +          ] },
    1.98 +          { DEFINITION: [ // dd
    1.99 +            { TEXT_LEAF: [] }
   1.100 +          ] },
   1.101 +          { TERM: [ // dt
   1.102 +            { TEXT_LEAF: [] }
   1.103 +          ] },
   1.104 +          { DEFINITION: [ // dd
   1.105 +            { TEXT_LEAF: [] }
   1.106 +          ] }
   1.107 +        ] };
   1.108 +
   1.109 +      testAccessibleTree("list5", tree);
   1.110 +
   1.111 +      // dl list inside ordered list
   1.112 +      tree =
   1.113 +        { LIST: [ // ol
   1.114 +          { LISTITEM: [ // li
   1.115 +            { STATICTEXT: [ ] },
   1.116 +            { DEFINITION_LIST: [ // dl
   1.117 +              { TERM: [ // dt
   1.118 +                { TEXT_LEAF: [] }
   1.119 +              ] },
   1.120 +              { DEFINITION: [ // dd
   1.121 +                { TEXT_LEAF: [] }
   1.122 +              ] }
   1.123 +            ] }
   1.124 +          ] }
   1.125 +        ] };
   1.126 +
   1.127 +      testAccessibleTree("list6", tree);
   1.128 +
   1.129 +      // li having no display:list-item style
   1.130 +      var tree =
   1.131 +        { LIST: [ // ul
   1.132 +          { LISTITEM: [ // li
   1.133 +            { TEXT_LEAF: [] },
   1.134 +          ] },
   1.135 +          { TEXT_LEAF: [] },
   1.136 +          { LISTITEM: [ // li
   1.137 +            { TEXT_LEAF: [] }
   1.138 +          ] }
   1.139 +        ] };
   1.140 +      testAccessibleTree("list7", tree);
   1.141 +
   1.142 +      var tree =
   1.143 +        { LIST: [ // ul
   1.144 +          { LISTITEM: [ // li
   1.145 +            { TEXT_LEAF: [] },
   1.146 +          ] },
   1.147 +          { LISTITEM: [ // li
   1.148 +            { TEXT_LEAF: [] }
   1.149 +          ] }
   1.150 +        ] };
   1.151 +      testAccessibleTree("list8", tree);
   1.152 +
   1.153 +      // span having display:list-item style
   1.154 +      testAccessibleTree("list9", discAccTree);
   1.155 +
   1.156 +      SimpleTest.finish();
   1.157 +    }
   1.158 +
   1.159 +    SimpleTest.waitForExplicitFinish();
   1.160 +    addA11yLoadEvent(doTest);
   1.161 +  </script>
   1.162 +</head>
   1.163 +<body>
   1.164 +
   1.165 +  <a target="_blank"
   1.166 +     title="Fix O(n^2) access to all the children of a container"
   1.167 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=342045">
   1.168 +    Mozilla Bug 342045
   1.169 +  </a>
   1.170 +  <a target="_blank"
   1.171 +     title="Wrong accessible is created for HTML:li having block display style"
   1.172 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=507555">
   1.173 +    Mozilla Bug 507555
   1.174 +  </a>
   1.175 +  <a target="_blank"
   1.176 +     title="Bullets of nested not ordered lists have one and the same character."
   1.177 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=604587">
   1.178 +    Mozilla Bug 604587
   1.179 +  </a>
   1.180 +  <a target="_blank"
   1.181 +     title="Fix list bullets for DL list (crash [@ nsBulletFrame::GetListItemText])"
   1.182 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=629114">
   1.183 +    Mozilla Bug 629114
   1.184 +  </a>
   1.185 +  <p id="display"></p>
   1.186 +  <div id="content" style="display: none"></div>
   1.187 +  <pre id="test">
   1.188 +  </pre>
   1.189 +
   1.190 +  <ul id="list1">
   1.191 +    <li id="l1_li1">Oranges</li>
   1.192 +    <li id="l1_li2">Apples</li>
   1.193 +    <li id="l1_li3">Bananas</li>
   1.194 +  </ul>
   1.195 +
   1.196 +  <ul id="list2" style="list-style-type: circle">
   1.197 +    <li id="l2_li1">Oranges</li>
   1.198 +    <li id="l2_li2">Apples</li>
   1.199 +    <li id="l2_li3">Bananas</li>
   1.200 +  </ul>
   1.201 +
   1.202 +  <ul id="list3" style="list-style-type: square">
   1.203 +    <li id="l3_li1">Oranges</li>
   1.204 +    <li id="l3_li2">Apples</li>
   1.205 +    <li id="l3_li3">Bananas</li>
   1.206 +  </ul>
   1.207 +
   1.208 +  <ol id="list4">
   1.209 +    <li id="li4">Oranges</li>
   1.210 +    <li id="li5">Apples</li>
   1.211 +    <li id="li6">Bananas<ul>
   1.212 +        <li id="n_li4">Oranges</li>
   1.213 +        <li id="n_li5">Apples</li>
   1.214 +        <li id="n_li6">Bananas</li>
   1.215 +      </ul>
   1.216 +    </li>
   1.217 +  </ol>
   1.218 +
   1.219 +  <dl id="list5">
   1.220 +    <dt>item1</dt><dd>description</dd>
   1.221 +    <dt>item2</td><dd>description</dd>
   1.222 +  </dl>
   1.223 +
   1.224 +  <ol id="list6">
   1.225 +    <li>
   1.226 +      <dl id="dl">
   1.227 +        <dt>item1</dt><dd>description</dd>
   1.228 +      </dl>
   1.229 +    </li>
   1.230 +  </ol>
   1.231 +
   1.232 +  <!-- display style different than list-item -->
   1.233 +  <ul id="list7">
   1.234 +    <li id="l7_li1" style="display:inline-block;">Oranges</li>
   1.235 +    <li id="l7_li2" style="display:inline-block;">Apples</li>
   1.236 +  </ul>
   1.237 +
   1.238 +  <ul id="list8">
   1.239 +    <li id="l8_li1" style="display:inline; float:right;">Oranges</li>
   1.240 +    <li id="l8_li2" style="display:inline; float:right;">Apples</li>
   1.241 +  </ul>
   1.242 +
   1.243 +  <!-- list-item display style -->
   1.244 +  <ul id="list9">
   1.245 +    <span id="l9_li1" style="display:list-item">Oranges</span>
   1.246 +    <span id="l9_li2" style="display:list-item">Apples</span>
   1.247 +    <span id="l9_li3" style="display:list-item">Bananas</span>
   1.248 +  </ul>
   1.249 +</body>
   1.250 +</html>

mercurial