OLD | NEW |
---|---|
(Empty) | |
1 <!doctype html> | |
2 <script src="../../resources/testharness.js"></script> | |
3 <script src="../../resources/testharnessreport.js"></script> | |
4 <script src="../assert_selection.js"></script> | |
5 <script> | |
6 test(() => assert_selection( | |
7 [ | |
8 '<div contenteditable>', | |
9 '<div><span style="color: red;">abfg</span></div>', | |
10 '<div>^cde|</div>', | |
11 '</div>', | |
12 ].join(''), | |
13 selection => { | |
14 assert_not_equals(window.testRunner, undefined, | |
15 'This test requires testRunner'); | |
16 selection.document.execCommand('cut'); | |
17 selection.document.execCommand('delete'); | |
18 selection.modify('move', 'backward', 'line'); | |
19 selection.modify('move', 'forward', 'character'); | |
20 selection.modify('move', 'forward', 'character'); | |
yoichio
2016/08/31 08:20:25
Could you use collapse()?
yosin_UTC9
2016/08/31 09:58:40
Done.
| |
21 selection.document.execCommand('paste'); | |
22 }, | |
23 [ | |
24 '<div contenteditable>', | |
25 '<div><span style="color: red;">ab</span>cde|<span style="color: red;">fg</span></div>', | |
26 '</div>', | |
27 ].join('')), | |
28 'Paste into middle of colored SPAN'); | |
29 | |
30 test(() => assert_selection( | |
31 [ | |
32 '<div contenteditable>', | |
33 '<div style="margin-left: 40px; text-indent: -40px;">^foo|</div> ', | |
34 '</div>', | |
35 ].join(''), | |
36 selection => { | |
37 assert_not_equals(window.testRunner, undefined, | |
38 'This test requires testRunner'); | |
39 selection.document.execCommand('cut'); | |
40 selection.document.execCommand('paste'); | |
41 }, | |
42 [ | |
43 '<div contenteditable>', | |
44 '<div style="margin-left: 40px; text-indent: -40px;">foo|</div>' , | |
45 '</div>', | |
46 ].join('')), | |
47 'Keep text-indent at pasting'); | |
48 </script> | |
OLD | NEW |