accessible/tests/mochitest/relations/test_ui_modalprompt.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/relations/test_ui_modalprompt.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,107 @@
     1.4 +<html>
     1.5 +
     1.6 +<head>
     1.7 +  <title>Modal prompts</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 +  <script type="application/javascript"
    1.14 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    1.15 +
    1.16 +  <script type="application/javascript"
    1.17 +          src="../common.js"></script>
    1.18 +  <script type="application/javascript"
    1.19 +          src="../relations.js"></script>
    1.20 +  <script type="application/javascript"
    1.21 +          src="../role.js"></script>
    1.22 +  <script type="application/javascript"
    1.23 +          src="../events.js"></script>
    1.24 +  <script type="application/javascript"
    1.25 +          src="../browser.js"></script>
    1.26 +
    1.27 +  <script type="application/javascript">
    1.28 +    function hasTabModalPrompts() {
    1.29 +      try {
    1.30 +        return SpecialPowers.getBoolPref("prompts.tab_modal.enabled");
    1.31 +      } catch (ex) {
    1.32 +        return false;
    1.33 +      }
    1.34 +    }
    1.35 +
    1.36 +    function showAlert()
    1.37 +    {
    1.38 +      this.eventSeq = [
    1.39 +        {
    1.40 +          type: EVENT_SHOW,
    1.41 +          match: function(aEvent)
    1.42 +          {
    1.43 +            return aEvent.accessible.role == ROLE_DIALOG;
    1.44 +          }
    1.45 +        }
    1.46 +      ];
    1.47 +
    1.48 +      this.invoke = function showAlert_invoke()
    1.49 +      {
    1.50 +        window.setTimeout(
    1.51 +          function()
    1.52 +          {
    1.53 +            currentTabDocument().defaultView.alert("hello");
    1.54 +          }, 0);
    1.55 +      }
    1.56 +
    1.57 +      this.check = function showAlert_finalCheck(aEvent)
    1.58 +      {
    1.59 +        var dialog = aEvent.accessible.DOMNode;
    1.60 +        var info = dialog.ui.infoBody;
    1.61 +        testRelation(info, RELATION_DESCRIPTION_FOR, dialog);
    1.62 +        testRelation(dialog, RELATION_DESCRIBED_BY, info);
    1.63 +      }
    1.64 +
    1.65 +      this.getID = function showAlert_getID()
    1.66 +      {
    1.67 +        return "show alert";
    1.68 +      }
    1.69 +    }
    1.70 +
    1.71 +    //gA11yEventDumpToConsole = true; // debug
    1.72 +
    1.73 +    var gQueue = null;
    1.74 +    function doTests()
    1.75 +    {
    1.76 +      gQueue = new eventQueue();
    1.77 +      gQueue.push(new showAlert());
    1.78 +      gQueue.onFinish = function()
    1.79 +      {
    1.80 +        synthesizeKey("VK_RETURN", {}, browserWindow());
    1.81 +        closeBrowserWindow();
    1.82 +      }
    1.83 +      gQueue.invoke(); // will call SimpleTest.finish()
    1.84 +    }
    1.85 +
    1.86 +    if (!hasTabModalPrompts()) {
    1.87 +      todo(false, "Test disabled when tab modal prompts are not enabled.");
    1.88 +    } else {
    1.89 +      SimpleTest.waitForExplicitFinish();
    1.90 +      openBrowserWindow(doTests);
    1.91 +    }
    1.92 +  </script>
    1.93 +
    1.94 +</head>
    1.95 +
    1.96 +<body id="body">
    1.97 +
    1.98 +  <a target="_blank"
    1.99 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=661293"
   1.100 +     title="The tabmodalprompt dialog's prompt label doesn't get the text properly associated for accessibility">
   1.101 +    Mozilla Bug 661293
   1.102 +  </a>
   1.103 +  <br>
   1.104 +  <p id="display"></p>
   1.105 +  <div id="content" style="display: none"></div>
   1.106 +  <pre id="test">
   1.107 +  </pre>
   1.108 +
   1.109 +</body>
   1.110 +</html>

mercurial