accessible/tests/mochitest/events/test_focus_aria_activedescendant.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <!DOCTYPE html>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=429547
     5 -->
     6 <head>
     7   <title>aria-activedescendant focus tests</title>
     8   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    10   <script type="application/javascript"
    11           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    13   <script type="application/javascript"
    14           src="../common.js"></script>
    15   <script type="application/javascript"
    16           src="../role.js"></script>
    17   <script type="application/javascript"
    18           src="../states.js"></script>
    19   <script type="application/javascript"
    20           src="../events.js"></script>
    22   <script type="application/javascript">
    23     //gA11yEventDumpToConsole = true; // debugging
    25     function changeARIAActiveDescendant(aID, aItemID)
    26     {
    27       this.eventSeq = [
    28         new focusChecker(aItemID)
    29       ];
    31       this.invoke = function changeARIAActiveDescendant_invoke()
    32       {
    33         getNode(aID).setAttribute("aria-activedescendant", aItemID);
    34       }
    36       this.getID = function changeARIAActiveDescendant_getID()
    37       {
    38         return "change aria-activedescendant on " + aItemID;
    39       }
    40     }
    42     function insertItemNFocus(aID, aNewItemID)
    43     {
    44       this.eventSeq = [
    45         new invokerChecker(EVENT_SHOW, aNewItemID),
    46         new focusChecker(aNewItemID)
    47       ];
    49       this.invoke = function insertItemNFocus_invoke()
    50       {
    51         var container  = getNode(aID);
    52         var itemNode = document.createElement("div");
    53         itemNode.setAttribute("id", aNewItemID);
    54         itemNode.textContent = "item3";
    55         container.appendChild(itemNode);
    57         container.setAttribute("aria-activedescendant", aNewItemID);
    58       }
    60       this.getID = function insertItemNFocus_getID()
    61       {
    62         return "insert new node and focus it with ID: " + aNewItemID;
    63       }
    64     }
    66     var gQueue = null;
    67     function doTest()
    68     {
    69       gQueue = new eventQueue();
    71       gQueue.push(new synthFocus("container", new focusChecker("item1")));
    72       gQueue.push(new changeARIAActiveDescendant("container", "item2"));
    74       gQueue.push(new synthFocus("combobox_entry", new focusChecker("combobox_entry")));
    75       gQueue.push(new changeARIAActiveDescendant("combobox", "combobox_option2"));
    77       todo(false, "No focus for inserted element, bug 687011");
    78       //gQueue.push(new insertItemNFocus("container", "item3"));
    80       gQueue.invoke(); // Will call SimpleTest.finish();
    81     }
    83     SimpleTest.waitForExplicitFinish();
    84     addA11yLoadEvent(doTest);
    85   </script>
    86 </head>
    87 <body>
    89   <a target="_blank"
    90      href="https://bugzilla.mozilla.org/show_bug.cgi?id=429547"
    91      title="Support aria-activedescendant usage in nsIAccesible::TakeFocus()">
    92     Mozilla Bug 429547
    93   </a>
    94   <a target="_blank"
    95      href="https://bugzilla.mozilla.org/show_bug.cgi?id=761102"
    96      title="Focus may be missed when ARIA active-descendant is changed on active composite widget">
    97     Mozilla Bug 761102
    98   </a>
    99   <p id="display"></p>
   100   <div id="content" style="display: none"></div>
   101   <pre id="test">
   102   </pre>
   104   <div role="listbox" aria-activedescendant="item1" id="container" tabindex="1">
   105     <div role="listitem" id="item1">item1</div>
   106     <div role="listitem" id="item2">item2</div>
   107   </div>
   109   <div role="combobox" id="combobox">
   110     <input id="combobox_entry">
   111     <ul>
   112       <li role="option" id="combobox_option1">option1</li>
   113       <li role="option" id="combobox_option2">option2</li>
   114     </ul>
   115   </div>
   116 </body>
   117 </html>

mercurial