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 id="sample" 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 const sample = selection.document.getElementById('sample'); | |
19 selection.collapse(sample.firstChild, 2); | |
20 selection.document.execCommand('paste'); | |
yoichio
2016/09/01 07:56:46
Can we have clipboard function in assert_selection
| |
21 }, | |
22 [ | |
23 '<div contenteditable>', | |
24 '<div>', | |
25 '<span id="sample" style="color: red;">ab</span>', | |
26 'cde|', | |
27 '<span style="color: red;">fg</span>', | |
28 '</div>', | |
29 '</div>', | |
30 ].join('')), | |
31 'Paste into middle of colored SPAN'); | |
32 | |
33 test(() => assert_selection( | |
34 [ | |
35 '<div contenteditable>', | |
36 '<div style="margin-left: 40px; text-indent: -40px;">^foo|</div> ', | |
37 '</div>', | |
38 ].join(''), | |
39 selection => { | |
40 assert_not_equals(window.testRunner, undefined, | |
41 'This test requires testRunner'); | |
42 selection.document.execCommand('cut'); | |
43 selection.document.execCommand('paste'); | |
44 }, | |
45 [ | |
46 '<div contenteditable>', | |
47 '<div style="margin-left: 40px; text-indent: -40px;">foo|</div>' , | |
48 '</div>', | |
49 ].join('')), | |
50 'Keep text-indent at pasting'); | |
51 </script> | |
OLD | NEW |