Bug 1880216 - Migrate Fenix docs into Sphinx. r=owlish,geckoview-reviewers,android...
[gecko.git] / dom / html / test / test_bug583533.html
blobc0b8c92e9595c7972ce9301db95aa385d83a66a3
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=583533
5 -->
6 <head>
7 <title>Test for Bug 583514</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=583533">Mozilla Bug 583533</a>
13 <p id="display"></p>
14 <div id="content">
15 <div id="e" accesskey="a">
16 </div>
17 </div>
18 <pre id="test">
19 <script type="application/javascript">
21 /** Test for Bug 583533 **/
23 var sbs = SpecialPowers.Cc['@mozilla.org/intl/stringbundle;1'].
24 getService(SpecialPowers.Ci.nsIStringBundleService);
25 var bundle = sbs.createBundle("chrome://global-platform/locale/platformKeys.properties");
27 var shiftText = bundle.GetStringFromName("VK_SHIFT");
28 var altText = bundle.GetStringFromName("VK_ALT");
29 var controlText = bundle.GetStringFromName("VK_CONTROL");
30 var metaText = bundle.GetStringFromName("VK_COMMAND_OR_WIN");
31 var separatorText = bundle.GetStringFromName("MODIFIER_SEPARATOR");
33 var modifier = SpecialPowers.getIntPref("ui.key.contentAccess");
35 var isShift;
36 var isAlt;
37 var isControl;
38 var isMeta;
40 is(modifier < 16 && modifier >= 0, true, "Modifier in range");
42 // There are no consts for the mask of this prefs.
43 if (modifier & 8) {
44 isMeta = true;
46 if (modifier & 1) {
47 isShift = true;
49 if (modifier & 2) {
50 isControl = true;
52 if (modifier & 4) {
53 isAlt = true;
56 var label = "";
58 if (isControl)
59 label += controlText + separatorText;
60 if (isMeta)
61 label += metaText + separatorText;
62 if (isAlt)
63 label += altText + separatorText;
64 if (isShift)
65 label += shiftText + separatorText;
67 label += document.getElementById("e").accessKey;
69 is(label, document.getElementById("e").accessKeyLabel, "JS and C++ agree on accessKeyLabel");
71 /** Test for Bug 808964 **/
73 var div = document.createElement("div");
74 document.body.appendChild(div);
76 is(div.accessKeyLabel, "", "accessKeyLabel should be empty string");
78 </script>
79 </pre>
80 </body>
81 </html>