Merge mozilla-central to autoland on a CLOSED TREE
[gecko.git] / widget / tests / test_autocapitalize.html
blob833dafe1afcfc65fc62662b5597dcee70ea8f4c8
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Tests for autocapitalize that is used by software keyboard</title>
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script src="/tests/SimpleTest/SpecialPowers.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
8 </head>
9 <body>
10 <p id="display"></p>
11 <div id="content" style="display: none"></div>
13 <div>
14 <input type="text" id="a1"><br>
15 <input type="text" id="a2" autocapitalize="characters"><br>
16 <input type="text" id="a3" autocapitalize="sentences"><br>
17 <input type="text" id="a4" autocapitalize="words"><br>
18 <input type="text" id="a5" autocapitalize="off"><br>
19 <input type="text" id="a6" autocapitalize="on"><br>
20 <input type="url" id="a7" autocapitalize="on"><br>
21 <input type="email" id="a8" autocapitalize="on"><br>
22 <input type="password" id="a9" autocapitalize="on"><br>
23 <textarea id="b1" autocapitalize="characters"></textarea><br>
24 <div contenteditable id="c1" autocapitalize="sentences"></div><br>
25 <form><input type="text" id="d1" autocapitalize="words"></form><br>
26 <form autocapitalize="on"><input type="text" id="d2"></form><br>
27 <form autocapitalize="off"><input type="text" id="d3" autocapitalize="on"></form><br>
28 </div>
30 <pre id="test">
31 <script class="testbody" type="application/javascript">
32 SimpleTest.waitForExplicitFinish();
34 SimpleTest.waitForFocus(async () => {
35 const tests = [
36 { id: "a1", autocapitalize: "", desc: "input without autocapitalize" },
37 { id: "a2", autocapitalize: "characters", desc: "input with autocapitalize=characters" },
38 { id: "a3", autocapitalize: "sentences", desc: "input with autocapitalize=sentences" },
39 { id: "a4", autocapitalize: "words", desc: "input with autocapitalize=words" },
40 { id: "a5", autocapitalize: "none", desc: "input with autocapitalize=off" },
41 { id: "a6", autocapitalize: "sentences", desc: "input with autocapitalize=on" },
42 { id: "a7", autocapitalize: "", desc: "input with type=url and autocapitalize=on" },
43 { id: "a8", autocapitalize: "", desc: "input with type=email and autocapitalize=on" },
44 { id: "a9", autocapitalize: "", desc: "input with type=password and autocapitalize=on" },
45 { id: "b1", autocapitalize: "characters", desc: "textarea with autocapitalize=characters" },
46 { id: "c1", autocapitalize: "sentences", desc: "contenteditable with autocapitalize=sentences" },
47 { id: "d1", autocapitalize: "words", desc: "input with autocapitalize=words in form" },
48 { id: "d2", autocapitalize: "sentences", desc: "input in form with autocapitalize=on" },
49 { id: "d3", autocapitalize: "sentences", desc: "input with autocapitalize=on in form" },
52 await SpecialPowers.setBoolPref("dom.forms.autocapitalize", true);
54 for (let test of tests) {
55 document.getElementById(test.id).focus();
56 is(SpecialPowers.DOMWindowUtils.focusedAutocapitalize, test.autocapitalize, test.desc);
59 SpecialPowers.clearUserPref("dom.forms.autocapitalize");
60 SimpleTest.finish();
61 });
62 </script>
63 </pre>
64 </body>
65 </html>