3 https://bugzilla.mozilla.org/show_bug.cgi?id=1568996
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" />
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1568996">Bug
1568996</a>
15 <div id=
"content" style=
"display: none"></div>
19 add_task(async () => {
20 await
new Promise((resolve
) => {
21 SimpleTest
.waitForFocus(() => {
22 SimpleTest
.executeSoon(resolve
);
26 let input1
= document
.getElementById("input1");
27 input1
.value
= "hello"
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
);
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
);
46 synthesizeKey('KEY_Delete');
47 is(input1
.value
, "1ello", "Delete key should be worked");
50 synthesizeKey('KEY_Delete');
51 synthesizeKey('KEY_Delete');
52 is(input1
.value
, "1blo", "Multiple delete key should be worked");
54 synthesizeKey('KEY_ArrowRight');
56 synthesizeKey('KEY_Delete');
57 is(input1
.value
, "1bl2", "Delete key should be worked");
60 is(input1
.value
, "1bl23", "charcter should be inserted");
62 synthesizeKey('KEY_Backspace');
63 is(input1
.value
, "1bl2", "Backspace key should be worked");