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(() => assert_selection( | 6 test(() => assert_selection( |
7 '<div contenteditable>here is <i>some|</i> text</div>', | 7 '<div contenteditable>here is <i>some|</i> text</div>', |
8 selection => { | 8 selection => { |
9 for (var i = 0; i < 5; ++i) | 9 for (var i = 0; i < 5; ++i) |
10 selection.document.execCommand('delete'); | 10 selection.document.execCommand('delete'); |
11 for (var i = 0; i < 4; ++i) | 11 for (var i = 0; i < 4; ++i) |
12 selection.document.execCommand('insertText', false, 'x'); | 12 selection.document.execCommand('insertText', false, 'x'); |
13 }, | 13 }, |
14 '<div contenteditable>here isxxxx|\u{00A0}text</div>'), | 14 '<div contenteditable>here isxxxx|\u{00A0}text</div>'), |
15 'Delete all styled characters then typing character does not keep style'
); | 15 'Delete all styled characters and previous character then typing charact
er does not keep style'); |
16 | 16 |
17 test(() => assert_selection( | 17 test(() => assert_selection( |
18 '<div contenteditable>here is <i>some|</i> text</div>', | 18 '<div contenteditable>here is <i>some|</i> text</div>', |
| 19 selection => { |
| 20 for (var i = 0; i < 4; ++i) |
| 21 selection.document.execCommand('delete'); |
| 22 for (var i = 0; i < 4; ++i) |
| 23 selection.document.execCommand('insertText', false, 'x'); |
| 24 }, |
| 25 '<div contenteditable>here is <i>xxxx|</i>\u{00A0}text</div>'), |
| 26 'Delete all styled characters then typing character keeps style'); |
| 27 |
| 28 test(() => assert_selection( |
| 29 '<div contenteditable>here is <i>some|</i> text</div>', |
19 selection => { | 30 selection => { |
20 for (var i = 0; i < 3; ++i) | 31 for (var i = 0; i < 3; ++i) |
21 selection.document.execCommand('delete'); | 32 selection.document.execCommand('delete'); |
22 for (var i = 0; i < 4; ++i) | 33 for (var i = 0; i < 4; ++i) |
23 selection.document.execCommand('insertText', false, 'x'); | 34 selection.document.execCommand('insertText', false, 'x'); |
24 }, | 35 }, |
25 '<div contenteditable>here is <i>sxxxx|</i>\u{00A0}text</div>'), | 36 '<div contenteditable>here is <i>sxxxx|</i>\u{00A0}text</div>'), |
26 'Delete some styled characters then typing character keeps style'); | 37 'Delete some styled characters then typing character keeps style'); |
27 | 38 |
28 test(() => assert_selection( | 39 test(() => assert_selection( |
29 '<div contenteditable>|</div>', | 40 '<div contenteditable>|</div>', |
30 selection => { | 41 selection => { |
31 selection.document.execCommand('insertText', false, 'abc'); | 42 selection.document.execCommand('insertText', false, 'abc'); |
32 | 43 |
33 selection.document.execCommand('bold'); | 44 selection.document.execCommand('bold'); |
34 selection.document.execCommand('insertText', false, 'def'); | 45 selection.document.execCommand('insertText', false, 'def'); |
35 | 46 |
36 selection.document.execCommand('italic'); | 47 selection.document.execCommand('italic'); |
37 selection.document.execCommand('insertText', false, 'ghi'); | 48 selection.document.execCommand('insertText', false, 'ghi'); |
38 | 49 |
39 selection.document.execCommand('bold'); // disable bold | 50 selection.document.execCommand('bold'); // disable bold |
40 selection.document.execCommand('insertText', false, 'jkl'); | 51 selection.document.execCommand('insertText', false, 'jkl'); |
41 | 52 |
42 selection.document.execCommand('italic'); // disable italic | 53 selection.document.execCommand('italic'); // disable italic |
43 selection.document.execCommand('insertText', false, 'mno'); | 54 selection.document.execCommand('insertText', false, 'mno'); |
44 }, | 55 }, |
45 '<div contenteditable>abc<b>def</b><i><b>ghi</b>jkl</i>mno|</div>'), | 56 '<div contenteditable>abc<b>def</b><i><b>ghi</b>jkl</i>mno|</div>'), |
46 'Nested styles and disabling styles'); | 57 'Nested styles and disabling styles'); |
47 </script> | 58 </script> |
OLD | NEW |