OLD | NEW |
---|---|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | 2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
3 <html xmlns="http://www.w3.org/1999/xhtml"> | 3 <html xmlns="http://www.w3.org/1999/xhtml"> |
4 <script src="../../resources/testharness.js"></script> | |
5 <script src="../../resources/testharnessreport.js"></script> | |
4 | 6 |
5 <head> | 7 <div contenteditable="" id="root"> |
6 | |
7 <style> | |
8 .editing { | |
9 border: 2px solid red; | |
10 padding: 12px; | |
11 font-size: 24px; | |
12 } | |
13 </style> | |
14 | |
15 <script src="../editing.js" language="JavaScript" type="text/JavaScript" /> | |
16 | |
17 <script> | |
18 | |
19 function editingTest() { | |
20 for (i = 0; i != 4; i++) | |
21 moveSelectionForwardByCharacterCommand(); | |
22 for (i = 0; i != 3; i++) | |
23 extendSelectionForwardByCharacterCommand(); | |
24 copyCommand(); | |
25 moveSelectionForwardByCharacterCommand(); | |
26 pasteCommand(); | |
27 } | |
28 | |
29 </script> | |
30 | |
31 </head> | |
32 | |
33 <body> | |
34 <div contenteditable="" id="root" class="editing"> | |
35 <span id="test">foo bar baz</span> | 8 <span id="test">foo bar baz</span> |
36 </div> | 9 </div> |
37 | 10 |
38 <script> | 11 <script> |
39 runDumpAsTextEditingTest(true); | 12 test(() => { |
13 assert_not_equals(window.internals, undefined, | |
14 'This test requires clipboard access'); | |
15 | |
16 const selection = window.getSelection(); | |
17 const root = document.getElementById('root'); | |
18 const test = document.getElementById('test'); | |
19 | |
20 selection.setBaseAndExtent(test.firstChild, 4, test.firstChild, 7); // foo ^ba r| baz | |
21 document.execCommand('copy'); | |
22 selection.collapse(test.firstChild, 7); // foo bar| baz | |
23 document.execCommand('paste'); | |
24 | |
25 const expectedText = '\n<span xmlns=\"http://www.w3.org/1999/xhtml\" id=\"t est\">foo barbar baz</span>\n'; | |
yosin_UTC9
2017/03/01 01:17:24
:-)
| |
26 assert_equals(root.innerHTML, expectedText); | |
27 assert_equals(selection.anchorNode, test.firstChild); | |
28 assert_equals(selection.anchorOffset, 10); | |
29 assert_equals(selection.type, 'Caret'); | |
30 }, 'Paste in XML'); | |
40 </script> | 31 </script> |
41 | 32 |
42 </body> | |
43 </html> | 33 </html> |
OLD | NEW |