Bug 1874684 - Part 17: Fix uninitialised variable warnings from clang-tidy. r=allstarschh
[gecko.git] / editor / libeditor / tests / test_bug1568996.html
blobe0d48dad76778fed0745afc22bd2dad7537b20c7
1 <!DOCTYPE html>
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=1568996
4 -->
5 <html>
6 <head>
7 <title>Test for Bug 1568996</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script src="/tests/SimpleTest/EventUtils.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1568996">Bug 1568996</a>
14 <p id="display"></p>
15 <div id="content" style="display: none"></div>
16 <pre id="test"></pre>
17 <input id="input1">
18 <script>
19 add_task(async () => {
20 await new Promise((resolve) => {
21 SimpleTest.waitForFocus(() => {
22 SimpleTest.executeSoon(resolve);
23 }, window);
24 });
26 let input1 = document.getElementById("input1");
27 input1.value = "hello"
28 input1.focus();
29 input1.setSelectionRange(0, 0);
31 input1.addEventListener('keydown', () => {
32 let s = input1.selectionStart;
33 let e = input1.selectionEnd;
34 input1.value = input1.value.toUpperCase();
35 input1.setSelectionRange(s, e);
36 });
38 input1.addEventListener('input', () => {
39 let s = input1.selectionStart;
40 let e = input1.selectionEnd;
41 input1.value = input1.value.toLowerCase();
42 input1.setSelectionRange(s, e);
43 });
45 synthesizeKey('1');
46 synthesizeKey('KEY_Delete');
47 is(input1.value, "1ello", "Delete key should be worked");
49 synthesizeKey('B');
50 synthesizeKey('KEY_Delete');
51 synthesizeKey('KEY_Delete');
52 is(input1.value, "1blo", "Multiple delete key should be worked");
54 synthesizeKey('KEY_ArrowRight');
55 synthesizeKey('2');
56 synthesizeKey('KEY_Delete');
57 is(input1.value, "1bl2", "Delete key should be worked");
59 synthesizeKey('3');
60 is(input1.value, "1bl23", "charcter should be inserted");
62 synthesizeKey('KEY_Backspace');
63 is(input1.value, "1bl2", "Backspace key should be worked");
64 });
65 </script>
66 </body>
67 </html>