OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <script src="../assert_selection.js"></script> | 4 <script src="../assert_selection.js"></script> |
5 <script> | 5 <script> |
6 test(() => { | 6 test(() => { |
7 assert_not_equals( | 7 assert_not_equals( |
8 window.testRunner, undefined, | 8 window.testRunner, undefined, |
9 'This test requires testRunner.'); | 9 'This test requires testRunner.'); |
10 | 10 |
11 assert_selection( | 11 assert_selection( |
12 [ | 12 [ |
13 '<div contenteditable>^foo bar baz.|</div>', | 13 '<div contenteditable>^foo bar baz.|</div>', |
14 '<div contenteditable id="paste"><br></div>' | 14 '<div contenteditable id="paste"><br></div>' |
15 ].join(''), | 15 ].join(''), |
16 selection => { | 16 selection => { |
17 const document = selection.document; | 17 const document = selection.document; |
18 document.execCommand('underline'); | 18 document.execCommand('underline'); |
19 document.execCommand('copy'); | 19 document.execCommand('copy'); |
20 document.getElementById('paste').focus(); | 20 document.getElementById('paste').focus(); |
21 document.execCommand('paste'); | 21 document.execCommand('paste'); |
22 }, | 22 }, |
23 [ | 23 [ |
24 '<div contenteditable><u>foo bar baz.</u></div>', | 24 '<div contenteditable><u>foo bar baz.</u></div>', |
25 '<div contenteditable id="paste"><u>foo bar baz.|</u></div>' | 25 '<div contenteditable id="paste"><u>foo bar baz.|</u></div>' |
26 ].join('')); | 26 ].join('')); |
27 }, 'Copy/paste underlined text.'); | 27 }, 'Copy/paste underlined text.'); |
| 28 |
| 29 test(() => { |
| 30 assert_not_equals( |
| 31 window.testRunner, undefined, |
| 32 'This test requires testRunner.'); |
| 33 |
| 34 assert_selection( |
| 35 [ |
| 36 '<div contenteditable spellcheck="false">^foo bar baz.|</div>', |
| 37 '<div contenteditable id="paste"><br></div>' |
| 38 ].join(''), |
| 39 selection => { |
| 40 const document = selection.document; |
| 41 document.execCommand('underline'); |
| 42 document.execCommand('copy'); |
| 43 document.getElementById('paste').focus(); |
| 44 document.execCommand('paste'); |
| 45 }, |
| 46 [ |
| 47 '<div contenteditable spellcheck="false"><u>foo bar baz.</u></div>', |
| 48 '<div contenteditable id="paste"><u>foo bar baz.|</u></div>' |
| 49 ].join('')); |
| 50 }, 'Copy/paste underlined text with spell checker off.'); |
28 </script> | 51 </script> |
OLD | NEW |