accessible/tests/mochitest/events/test_focus_dialog.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 <html>
     3 <head>
     4   <title>Accessible focus testing</title>
     6   <link rel="stylesheet" type="text/css"
     7         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     9   <script type="application/javascript"
    10           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    11   <script type="application/javascript"
    12           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    14   <script type="application/javascript"
    15           src="../common.js"></script>
    16   <script type="application/javascript"
    17           src="../events.js"></script>
    18   <script type="application/javascript"
    19           src="../role.js"></script>
    20   <script type="application/javascript"
    21           src="../states.js"></script>
    23   <script type="application/javascript">
    24     function openCloseDialog(aID)
    25     {
    26       this.eventSeq = [
    27         new focusChecker(getNode(aID))
    28       ];
    30       this.invoke = function openCloseDialog_invoke()
    31       {
    32         var wnd = window.open("focus.html");
    33         wnd.close();
    34       }
    36       this.getID = function openCloseDialog_getID()
    37       {
    38         return "Open close dialog while focus on " + prettyName(aID);
    39       }
    40     }
    42     var gDialogWnd = null;
    43     function getDialogDocument()
    44     {
    45       return gDialogWnd.document;
    46     }
    48     function openDialog(aID)
    49     {
    50       this.eventSeq = [
    51         new focusChecker(getDialogDocument)
    52       ];
    54       this.invoke = function openDialog_invoke()
    55       {
    56         gDialogWnd = window.open("focus.html");
    57       }
    59       this.getID = function openDialog_getID()
    60       {
    61         return "Open dialog while focus on " + prettyName(aID);
    62       }
    63     }
    65     function closeDialog(aID)
    66     {
    67       this.eventSeq = [
    68         new focusChecker(aID)
    69       ];
    71       this.invoke = function closeDialog_invoke()
    72       {
    73         gDialogWnd.close();
    74       }
    76       this.getID = function closeDialog_getID()
    77       {
    78         return "Close dialog while focus on " + prettyName(aID);
    79       }
    80     }
    82     function showNFocusAlertDialog()
    83     {
    84       this.ID = "alertdialog";
    85       this.DOMNode = getNode(this.ID);
    87       this.invoke = function showNFocusAlertDialog_invoke()
    88       {
    89         document.getElementById(this.ID).style.display = 'block';
    90         document.getElementById(this.ID).focus();
    91       }
    93       this.eventSeq = [
    94         new invokerChecker(EVENT_SHOW, this.DOMNode),
    95         new focusChecker(this.DOMNode)
    96       ];
    98       this.getID = function showNFocusAlertDialog_getID()
    99       {
   100         return "Show and focus alert dialog " + prettyName(this.ID);
   101       }
   102     }
   104     /**
   105      * Do tests.
   106      */
   108     //gA11yEventDumpID = "eventdump"; // debug stuff
   109     //gA11yEventDumpToConsole = true;
   111     var gQueue = null;
   113     function doTests()
   114     {
   115       gQueue = new eventQueue(EVENT_FOCUS);
   117       gQueue.push(new synthFocus("button"));
   118       gQueue.push(new openDialog("button"));
   119       gQueue.push(new closeDialog("button"));
   121       var frameNode = getNode("editabledoc");
   122       gQueue.push(new synthFocusOnFrame(frameNode));
   123       gQueue.push(new openCloseDialog(frameNode.contentDocument));
   125       gQueue.push(new showNFocusAlertDialog());
   127       gQueue.invoke(); // Will call SimpleTest.finish();
   128     }
   130     SimpleTest.waitForExplicitFinish();
   131     addA11yLoadEvent(doTests);
   132   </script>
   133 </head>
   135 <body>
   137   <a target="_blank"
   138      href="https://bugzilla.mozilla.org/show_bug.cgi?id=551679"
   139      title="focus is not fired for focused document when switching between windows">
   140     Mozilla Bug 551679
   141   </a>
   142   <a target="_blank"
   143      href="https://bugzilla.mozilla.org/show_bug.cgi?id=580464"
   144      title="Accessible focus incorrect after JS focus() but correct after switching apps or using menu bar">
   145     Mozilla Bug 580464
   146   </a>
   147   <p id="display"></p>
   148   <div id="content" style="display: none"></div>
   149   <pre id="test">
   150   </pre>
   152   <button id="button">button</button>
   153   <iframe id="editabledoc" src="focus.html"></iframe>
   155   <div id="alertdialog" style="display: none" tabindex="-1" role="alertdialog" aria-labelledby="title2" aria-describedby="desc2">
   156     <div id="title2">Blah blah</div>
   157     <div id="desc2">Woof woof woof.</div>
   158     <button>Close</button>
   159   </div>
   162   <div id="eventdump"></div>
   163 </body>
   164 </html>

mercurial