OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!doctype html> |
2 <html> | 2 <script src="../../resources/testharness.js"></script> |
3 <body> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <script src="../../resources/dump-as-markup.js"></script> | 4 <script src="../assert_selection.js"></script> |
5 <div id="test" contenteditable> | 5 <script> |
6 <pre> | 6 test(() => assert_selection( |
7 hello | 7 [ |
8 '<div contenteditable>', | |
9 '<pre>', | |
10 '^hello\n\nworld\n\nwebkit\n|', | |
11 '</pre>', | |
12 '</div>', | |
13 ].join(''), | |
14 'formatBlock h3', | |
15 [ | |
16 '<div contenteditable>', | |
17 '<h3>', | |
18 'hello<br>\nworld<br>\nwebkit', | |
19 '</h3>|', | |
20 '</div>', | |
21 ].join('')), | |
22 'formatBlock on all contents with H3'); | |
8 | 23 |
9 world | 24 test(() => assert_selection( |
25 [ | |
26 '<div contenteditable>', | |
27 '<pre>', | |
28 'hello\n\nworld\n\n^webkit\n|', | |
Xiaocheng
2016/08/25 01:48:39
The original test formats all but the last paragra
yosin_UTC9
2016/08/25 05:15:43
Done.
| |
29 '</pre>', | |
30 '</div>', | |
31 ].join(''), | |
32 'formatBlock h3', | |
33 [ | |
34 '<div contenteditable>', | |
35 '<pre>', | |
36 'hello\n\nworld\n\n<h3>^webkit|</h3>', | |
37 '</pre>', | |
38 '</div>', | |
39 ].join('')), | |
40 'formatBlock on last paragraph with H3'); | |
10 | 41 |
11 webkit | 42 test(() => assert_selection( |
12 </pre> | 43 [ |
13 </div> | 44 '<div contenteditable>', |
14 <script> | 45 '<pre>', |
15 | 46 'hello\n\n^world\n\nwebkit\n|', |
Xiaocheng
2016/08/25 01:48:39
Should be 'hello\n^\nworld\n\nwebkit\n|'
yosin_UTC9
2016/08/25 05:15:43
Done.
| |
16 Markup.description('This tests ensures formatBlock removes a pre when formatting multiple paragraphs inside the pre.'); | 47 '</pre>', |
17 | 48 '</div>', |
18 var test = document.getElementById('test'); | 49 ].join(''), |
19 var original = test.innerHTML; | 50 'formatBlock h3', |
20 window.getSelection().selectAllChildren(test); | 51 [ |
21 document.execCommand('formatBlock', false, 'h3'); | 52 '<div contenteditable>', |
22 Markup.dump(test, 'Formatting all paragraphs by h3 yields'); | 53 '<pre>', |
23 | 54 'hello\n\n<h3>world\nwebkit</h3>|', |
24 document.execCommand('undo', false, null); | 55 '</pre>', |
25 Markup.dump(test, 'Undo yields'); | 56 '</div>', |
26 window.getSelection().collapse(test, 0); | 57 ].join('')), |
27 window.getSelection().modify('extend', 'forward', 'line'); | 58 'formatBlock all but the first paragraph with H3'); |
28 window.getSelection().modify('extend', 'forward', 'line'); | |
29 window.getSelection().modify('extend', 'forward', 'line'); | |
30 window.getSelection().modify('extend', 'forward', 'line'); | |
31 document.execCommand('formatBlock', false, 'h3'); | |
32 Markup.dump(test, 'Formatting all but the last paragraph by h3 yields'); | |
33 | |
34 document.execCommand('undo', false, null); | |
35 Markup.dump(test, 'Undo yields'); | |
36 window.getSelection().collapse(test, 0); | |
37 window.getSelection().modify('move', 'forward', 'line'); | |
38 window.getSelection().modify('extend', 'forward', 'line'); | |
39 window.getSelection().modify('extend', 'forward', 'line'); | |
40 window.getSelection().modify('extend', 'forward', 'line'); | |
41 window.getSelection().modify('extend', 'forward', 'line'); | |
42 document.execCommand('formatBlock', false, 'h3'); | |
43 Markup.dump(test, 'Formatting all but the first paragraph by h3 yields'); | |
44 | |
45 </script> | 59 </script> |
46 </body> | |
47 </html> | |
OLD | NEW |