accessible/tests/mochitest/relations/test_ui_modalprompt.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <html>
     3 <head>
     4   <title>Modal prompts</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>
    10   <script type="application/javascript"
    11           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    13   <script type="application/javascript"
    14           src="../common.js"></script>
    15   <script type="application/javascript"
    16           src="../relations.js"></script>
    17   <script type="application/javascript"
    18           src="../role.js"></script>
    19   <script type="application/javascript"
    20           src="../events.js"></script>
    21   <script type="application/javascript"
    22           src="../browser.js"></script>
    24   <script type="application/javascript">
    25     function hasTabModalPrompts() {
    26       try {
    27         return SpecialPowers.getBoolPref("prompts.tab_modal.enabled");
    28       } catch (ex) {
    29         return false;
    30       }
    31     }
    33     function showAlert()
    34     {
    35       this.eventSeq = [
    36         {
    37           type: EVENT_SHOW,
    38           match: function(aEvent)
    39           {
    40             return aEvent.accessible.role == ROLE_DIALOG;
    41           }
    42         }
    43       ];
    45       this.invoke = function showAlert_invoke()
    46       {
    47         window.setTimeout(
    48           function()
    49           {
    50             currentTabDocument().defaultView.alert("hello");
    51           }, 0);
    52       }
    54       this.check = function showAlert_finalCheck(aEvent)
    55       {
    56         var dialog = aEvent.accessible.DOMNode;
    57         var info = dialog.ui.infoBody;
    58         testRelation(info, RELATION_DESCRIPTION_FOR, dialog);
    59         testRelation(dialog, RELATION_DESCRIBED_BY, info);
    60       }
    62       this.getID = function showAlert_getID()
    63       {
    64         return "show alert";
    65       }
    66     }
    68     //gA11yEventDumpToConsole = true; // debug
    70     var gQueue = null;
    71     function doTests()
    72     {
    73       gQueue = new eventQueue();
    74       gQueue.push(new showAlert());
    75       gQueue.onFinish = function()
    76       {
    77         synthesizeKey("VK_RETURN", {}, browserWindow());
    78         closeBrowserWindow();
    79       }
    80       gQueue.invoke(); // will call SimpleTest.finish()
    81     }
    83     if (!hasTabModalPrompts()) {
    84       todo(false, "Test disabled when tab modal prompts are not enabled.");
    85     } else {
    86       SimpleTest.waitForExplicitFinish();
    87       openBrowserWindow(doTests);
    88     }
    89   </script>
    91 </head>
    93 <body id="body">
    95   <a target="_blank"
    96      href="https://bugzilla.mozilla.org/show_bug.cgi?id=661293"
    97      title="The tabmodalprompt dialog's prompt label doesn't get the text properly associated for accessibility">
    98     Mozilla Bug 661293
    99   </a>
   100   <br>
   101   <p id="display"></p>
   102   <div id="content" style="display: none"></div>
   103   <pre id="test">
   104   </pre>
   106 </body>
   107 </html>

mercurial