Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / input / change-style-with-key-binding.html
blobc4e8eaeb0f60ce6401dd92761e085fdf5f4664ec
1 <!DOCTYPE html>
2 <body>
3 <script src="../../resources/js-test.js"></script>
5 <div contenteditable id="root">
6 Foo
7 </div>
8 <script>
9 description('Test key bindings for toggling bold and italic.');
10 var root = document.getElementById('root');
11 root.focus();
12 document.execCommand('SelectAll');
13 if (!window.eventSender) {
14 debug('Try Control-B/Control-I (Command-B/Command-I on Mac) and see if they toggle bold/italic.');
15 } else {
16 shouldBe('root.querySelectorAll("b").length', '0');
17 shouldBe('root.querySelectorAll("i").length', '0');
18 eventSender.keyDown('b', ['addSelectionKey']);
19 shouldBe('root.querySelectorAll("b").length', '1');
20 shouldBe('root.querySelectorAll("i").length', '0');
21 eventSender.keyDown('i', ['addSelectionKey']);
22 shouldBe('root.querySelectorAll("b").length', '1');
23 shouldBe('root.querySelectorAll("i").length', '1');
24 eventSender.keyDown('b', ['addSelectionKey']);
25 shouldBe('root.querySelectorAll("b").length', '0');
26 shouldBe('root.querySelectorAll("i").length', '1');
27 eventSender.keyDown('i', ['addSelectionKey']);
28 shouldBe('root.querySelectorAll("b").length', '0');
29 shouldBe('root.querySelectorAll("i").length', '0');
31 </script>
32 </body>