accessible/tests/mochitest/tree/test_brokencontext.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4   <title>Broken context hierarchy</title>
     5   <link rel="stylesheet" type="text/css"
     6         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     8   <script type="application/javascript"
     9           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    11   <script type="application/javascript"
    12           src="../common.js"></script>
    13   <script type="application/javascript"
    14           src="../role.js"></script>
    15   <script type="application/javascript"
    16           src="../states.js"></script>
    18   <script type="application/javascript">
    19   /**
    20    * Return true if TD element has a generic accessible.
    21    */
    22   function isTDGeneric(aID)
    23   {
    24     return isAccessible(aID) && !isAccessible(aID, nsIAccessibleTableCell);
    25   }
    27   function checkIfNotAccessible(aID)
    28   {
    29     ok(!isAccessible(aID), "'" + aID + "' shouldn't be accessible");
    30   }
    31   function checkIfTDGeneric(aID)
    32   {
    33     ok(isTDGeneric(aID), "'" + aID + "' shouldn't have cell accessible");
    34   }
    36   function doTest()
    37   {
    38     ////////////////////////////////////////////////////////////////////////////
    39     // HTML table elements outside table context.
    41     // HTML table role="presentation"
    42     checkIfNotAccessible("tr_in_presentation_table");
    43     checkIfTDGeneric("th_in_presentation_table");
    44     checkIfTDGeneric("td_in_presentation_table");
    46     // HTML table role="button"
    47     var tree =
    48       { PUSHBUTTON: [ // table
    49           { NOTHING: [ // tr
    50             { NOTHING: [ // th
    51               { TEXT_LEAF: [ ] }
    52             ] },
    53             { NOTHING: [ // td
    54               { TEXT_LEAF: [ ] }
    55             ] }
    56           ] }
    57       ] };
    58     testAccessibleTree("button_table", tree);
    60     // HTML table display:inline
    61     checkIfNotAccessible("inline_table1");
    62     checkIfNotAccessible("tr_in_inline_table1");
    63     checkIfTDGeneric("td1_in_inline_table1");
    64     checkIfTDGeneric("td2_in_inline_table1");
    66     // HTML table display:inline inside table. We shouldn't be fooled
    67     // by the outside table and shouldn't create table accessible and table cell
    68     // accessible in this case.
    69     checkIfNotAccessible("inline_table2");
    70     checkIfNotAccessible("tr_in_inline_table2");
    71     checkIfTDGeneric("td_in_inline_table2");
    73     // HTML table display:block inside table. 
    74     checkIfNotAccessible("block_table");
    75     checkIfNotAccessible("tr_in_block_table");
    76     checkIfTDGeneric("td_in_block_table");
    78     ////////////////////////////////////////////////////////////////////////////
    79     // HTML list elements outside list context.
    81     ok(!isAccessible("presentation_ul"),
    82                      "presentational ul shouldn't be accessible");
    83     ok(!isAccessible("item_in_presentation_ul"),
    84                      "li in presentational ul shouldn't be accessible");
    85     ok(!isAccessible("styleditem_in_presentation_ul"),
    86                      "list styled span in presentational ul shouldn't be accessible");
    88     ok(!isAccessible("presentation_ol"),
    89                      "presentational ol shouldn't be accessible");
    90     ok(!isAccessible("item_in_presentation_ol"),
    91                      "li in presentational ol shouldn't be accessible");
    93     ok(!isAccessible("presentation_dl"),
    94                      "presentational dl shouldn't be accessible");
    95     ok(!isAccessible("dt_in_presentation_dl"),
    96                      "dt in presentational dl shouldn't be accessible");
    97     ok(!isAccessible("dd_in_presentation_dl"),
    98                      "dd in presentational dl shouldn't be accessible");
   100     tree =
   101       { PUSHBUTTON: [ // ul
   102         { NOTHING: [ // li
   103           { STATICTEXT: [ ] },
   104           { TEXT_LEAF: [ ] }
   105         ] },
   106         { NOTHING: [ // span styled as a list
   107           { STATICTEXT: [ ] },
   108           { TEXT_LEAF: [ ] }
   109         ] }
   110       ] };
   111     testAccessibleTree("button_ul", tree);
   113     tree =
   114       { PUSHBUTTON: [ // ol
   115         { NOTHING: [ // li
   116           { STATICTEXT: [ ] },
   117           { TEXT_LEAF: [ ] }
   118         ] }
   119       ] };
   120     testAccessibleTree("button_ol", tree);
   122     tree =
   123       { PUSHBUTTON: [ // dl
   124         { NOTHING: [ // dt
   125           { TEXT_LEAF: [ ] }
   126         ] },
   127         { NOTHING: [ // dd
   128           { TEXT_LEAF: [ ] }
   129         ] }
   130       ] };
   131     testAccessibleTree("button_dl", tree);
   133     ////////////////////////////////////////////////////////////////////////////
   134     // Styled as HTML table elements, accessible is created by tag name
   136     tree =
   137       { LINK: [ // a
   138         { TEXT_LEAF: [ ] }
   139       ] };
   140     testAccessibleTree("a_as_td", tree);
   142     tree =
   143       { HEADING: [
   144         { TEXT_LEAF: [ ] }
   145       ] };
   146     testAccessibleTree("h1_as_td", tree);
   147     testAccessibleTree("h2_as_td", tree);
   148     testAccessibleTree("h3_as_td", tree);
   149     testAccessibleTree("h4_as_td", tree);
   150     testAccessibleTree("h5_as_td", tree);
   151     testAccessibleTree("h6_as_td", tree);
   153     SimpleTest.finish();
   154   }
   156   SimpleTest.waitForExplicitFinish();
   157   addA11yLoadEvent(doTest);
   158   </script>
   159 </head>
   161 <body>
   162   <a target="_blank"
   163      href="https://bugzilla.mozilla.org/show_bug.cgi?id=706849"
   164      title="Create accessible by tag name as fallback if table descendant style is used out of table context">
   165     Bug 706849
   166   </a>
   167   <a target="_blank"
   168      href="https://bugzilla.mozilla.org/show_bug.cgi?id=804461"
   169      title="Build the context dependent tree ">
   170     Bug 804461
   171   </a>
   172   <a target="_blank"
   173      href="https://bugzilla.mozilla.org/show_bug.cgi?id=945435"
   174      title="Create generic accessible for td to not jamm the cell text">
   175     Bug 945435
   176   </a>
   177   <p id="display"></p>
   178   <div id="content" style="display: none"></div>
   179   <pre id="test">
   180   </pre>
   182   <!-- HTML table elements out of table -->
   183   <table role="presentation">
   184     <tr id="tr_in_presentation_table">
   185       <th id="th_in_presentation_table">not a header</th>
   186       <td id="td_in_presentation_table">not a cell</td>
   187     </tr>
   188   </table>
   190   <table role="button" id="button_table">
   191     <tr id="tr_in_button_table">
   192       <th id="th_in_button_table">not a header</th>
   193       <td id="td_in_button_table">not a cell</td>
   194     </tr>
   195   </table>
   197    <table id="inline_table1" border="1" style="display:inline">
   198     <tr id="tr_in_inline_table1">
   199      <td id="td1_in_inline_table1">table1 cell1</td>
   200      <td id="td2_in_inline_table1">table1 cell2</td>
   201     </tr>
   202    </table>
   204    <table id="table_containing_inlinetable"><tr><td>
   205      <table id="inline_table2" border="1" style="display:inline">
   206       <tr id="tr_in_inline_table2">
   207        <td id="td_in_inline_table2">cell</td>
   208       </tr>
   209      </table>
   210    </td></tr></table>
   212   <table>
   213     <tr>
   214       <td style="display:block">
   215         <table id="block_table" style="display:inline">
   216           <tr id="tr_in_block_table">
   217             <td id="td_in_block_table">cell0</td>
   218           </tr>
   219         </table>
   220       </td>
   221       <td>cell1</td>
   222    </tr>
   223   </table>
   225   <!-- HTML list elements out of list -->
   226   <ul role="presentation" id="presentation_ul">
   227     <li id="item_in_presentation_ul">item</li>
   228     <span id="styleditem_in_presentation_ul"
   229           style="display:list-item">Oranges</span>
   230   </ul>
   232   <ol role="presentation" id="presentation_ol">
   233     <li id="item_in_presentation_ol">item</li>
   234   </ol>
   236   <dl role="presentation" id="presentation_dl">
   237     <dt id="dt_in_presentation_dl">term</dt>
   238     <dd id="dd_in_presentation_dl">definition</dd>
   239   </dl>
   241   <ul role="button" id="button_ul">
   242     <li id="item_in_button_ul">item</li>
   243     <span id="styleditem_in_button_ul"
   244           style="display:list-item">Oranges</span>
   245   </ul>
   247   <ol role="button" id="button_ol">
   248     <li id="item_in_button_ul">item</li>
   249   </ol>
   251   <dl role="button" id="button_dl">
   252     <dt id="dt_in_button_dl">term</ld>
   253     <dd id="dd_in_button_dl">definition</dd>
   254   </dl>
   256   <!-- styled as HTML table elements -->
   257   <a id="a_as_td" style="display:table-cell;" href="http://www.google.com">Google</a>
   258   <h1 id="h1_as_td" style="display: table-cell;">h1</h1>
   259   <h2 id="h2_as_td" style="display: table-cell;">h2</h2>
   260   <h3 id="h3_as_td" style="display: table-cell;">h3</h3>
   261   <h4 id="h4_as_td" style="display: table-cell;">h4</h4>
   262   <h5 id="h5_as_td" style="display: table-cell;">h5</h5>
   263   <h6 id="h6_as_td" style="display: table-cell;">h6</h6>
   264 </body>
   265 </html>

mercurial