3 <script src=
"../../resources/js-test.js"></script>
5 <div contenteditable
id=
"root">
9 description('Test key bindings for toggling bold and italic.');
10 var root
= document
.getElementById('root');
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.');
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');