0752122b03f0083a94110e19dd3232c576a5daa8
[WebKit-https.git] / LayoutTests / fast / events / init-event-clears-capslock.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/js-test.js"></script>
5 <script>
6
7 description(`This tests invoking initKeyboardEvent after setting CapsLock state to true via KeyboardEvent's constructor.`);
8
9 evalAndLog(`keyEvent = new KeyboardEvent('keydown', { bubbles: true, cancelable: true, view: window, detail: 0, key: 'a', code: 'KeyA',
10     ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, modifierAltGraph: true, modifierCapsLock: true });`);
11 shouldBeTrue('keyEvent.ctrlKey');
12 shouldBeTrue('keyEvent.shiftKey');
13 shouldBeTrue('keyEvent.altKey');
14 shouldBeTrue('keyEvent.metaKey');
15 shouldBeTrue('keyEvent.getModifierState("Control")');
16 shouldBeTrue('keyEvent.getModifierState("Shift")');
17 shouldBeTrue('keyEvent.getModifierState("Alt")');
18 shouldBeTrue('keyEvent.getModifierState("Meta")');
19 shouldBeTrue('keyEvent.getModifierState("AltGraph")');
20 shouldBeTrue('keyEvent.getModifierState("CapsLock")');
21
22 evalAndLog(`keyEvent.initKeyboardEvent('keydown', false, false, window, 'U+0041', 0, /* ctrl */ false, /* alt */ false, /* shift */ false, /* meta */ false, /* altGraph */ false)`);
23 shouldBeFalse('keyEvent.ctrlKey');
24 shouldBeFalse('keyEvent.shiftKey');
25 shouldBeFalse('keyEvent.altKey');
26 shouldBeFalse('keyEvent.metaKey');
27 shouldBeFalse('keyEvent.getModifierState("Control")');
28 shouldBeFalse('keyEvent.getModifierState("Shift")');
29 shouldBeFalse('keyEvent.getModifierState("Alt")');
30 shouldBeFalse('keyEvent.getModifierState("Meta")');
31 shouldBeFalse('keyEvent.getModifierState("AltGraph")');
32 shouldBeFalse('keyEvent.getModifierState("CapsLock")');
33
34 evalAndLog(`keyEvent.initKeyboardEvent('keydown', false, false, window, 'U+0041', 0, /* ctrl */ true, /* alt */ true, /* shift */ true, /* meta */ true, /* altGraph */ true)`);
35 shouldBeTrue('keyEvent.ctrlKey');
36 shouldBeTrue('keyEvent.shiftKey');
37 shouldBeTrue('keyEvent.altKey');
38 shouldBeTrue('keyEvent.metaKey');
39 shouldBeTrue('keyEvent.getModifierState("Control")');
40 shouldBeTrue('keyEvent.getModifierState("Shift")');
41 shouldBeTrue('keyEvent.getModifierState("Alt")');
42 shouldBeTrue('keyEvent.getModifierState("Meta")');
43 shouldBeTrue('keyEvent.getModifierState("AltGraph")');
44 shouldBeFalse('keyEvent.getModifierState("CapsLock")');
45
46 </script>
47 </body>
48 </html>