OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html hidden> | 2 <html hidden> |
3 <head> | 3 <head> |
4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
6 <style> | 6 <style> |
7 html, head, style { | 7 html, head, style { |
8 display: block; | 8 display: block; |
9 } | 9 } |
10 </style> | 10 </style> |
11 </head> | 11 </head> |
12 <body> | 12 <body> |
13 <div id="sample">foo</div> | 13 <div id="sample">foo</div> |
14 <script> | 14 <script> |
15 document.designMode = 'on'; | 15 document.designMode = 'on'; |
16 document.execCommand('selectAll'); | 16 document.execCommand('selectAll'); |
17 document.execCommand('italic'); | 17 document.execCommand('italic'); |
18 document.execCommand('justifyLeft'); | 18 document.execCommand('justifyLeft'); |
19 document.documentElement.removeAttribute('hidden'); | 19 document.documentElement.removeAttribute('hidden'); |
20 | 20 |
21 test(() => { | 21 test(() => { |
22 var sample = document.getElementById('sample'); | 22 var sample = document.getElementById('sample'); |
23 assert_equals(sample.innerHTML, '<i>foo</i>'); | 23 assert_equals(sample.innerHTML, '<i>foo</i>'); |
24 const selection = window.getSelection(); | 24 // TODO(yosin): Once we do lazy visible position canonicalization, |
25 assert_equals(selection.anchorNode, sample.firstChild.firstChild, 'ancho
rNode'); | 25 // we should have a caret. |
26 assert_equals(selection.anchorOffset, 0, 'anchorOffset'); | 26 assert_equals(getSelection().rangeCount, 0); |
27 assert_equals(selection.focusNode, sample.firstChild.firstChild, 'focusN
ode'); | |
28 assert_equals(selection.focusOffset, 3, 'focusOffset'); | |
29 }, 'This is a crash test.'); | 27 }, 'This is a crash test.'); |
30 </script> | 28 </script> |
31 </body> | 29 </body> |
32 </html> | 30 </html> |
OLD | NEW |