OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <div id="container"> | 4 <div id="container"> |
5 <p id="description"></p> | 5 <p id="description"></p> |
6 <p>To test manually, place the cursor before 'w' of 'word' and delete it complet
ely character by character. Do ctrl+z. On Mac, 'word' should be selected. On oth
er platforms 'word' should not be selected and the cursor should be placed befor
e 'w' of 'word'.</p> | 6 <p>To test manually, place the cursor before 'w' of 'word' and delete it complet
ely character by character. Do ctrl+z. On Mac, 'word' should be selected. On oth
er platforms 'word' should not be selected and the cursor should be placed befor
e 'w' of 'word'.</p> |
7 <div id="test" style="border: 2px solid red;" contenteditable>This word should b
e selected only on mac.</div> | 7 <div id="test" style="border: 2px solid red;" contenteditable>This word should b
e selected only on mac.</div> |
8 </div> | 8 </div> |
9 <div id="console"></div> | 9 <div id="console"></div> |
10 <script src="../../fast/js/resources/js-test-pre.js"></script> | 10 <script src="../../resources/js-test.js"></script> |
11 <script> | 11 <script> |
12 description('Verifies the selection behavior on undoing a text deletion.'); | 12 description('Verifies the selection behavior on undoing a text deletion.'); |
13 var selectionNode = document.getElementById('test').firstChild; | 13 var selectionNode = document.getElementById('test').firstChild; |
14 var selectionOffset = selectionNode.data.indexOf(' ') + 1; | 14 var selectionOffset = selectionNode.data.indexOf(' ') + 1; |
15 var endOffsetMac = selectionNode.data.indexOf('d') + 1; | 15 var endOffsetMac = selectionNode.data.indexOf('d') + 1; |
16 var selection = window.getSelection(); | 16 var selection = window.getSelection(); |
17 | 17 |
18 function undoTest(platform, expectedStartNode, expectedStartOffset, expectedEndN
ode, expectedEndOffset, selectedText) { | 18 function undoTest(platform, expectedStartNode, expectedStartOffset, expectedEndN
ode, expectedEndOffset, selectedText) { |
19 debug(platform); | 19 debug(platform); |
20 internals.settings.setEditingBehavior(platform); | 20 internals.settings.setEditingBehavior(platform); |
(...skipping 14 matching lines...) Expand all Loading... |
35 undoTest('mac', selectionNode, selectionOffset, selectionNode, endOffsetMac,
'word'); | 35 undoTest('mac', selectionNode, selectionOffset, selectionNode, endOffsetMac,
'word'); |
36 undoTest('win', selectionNode, selectionOffset, selectionNode, selectionOffs
et, ''); | 36 undoTest('win', selectionNode, selectionOffset, selectionNode, selectionOffs
et, ''); |
37 undoTest('unix', selectionNode, selectionOffset, selectionNode, selectionOff
set, ''); | 37 undoTest('unix', selectionNode, selectionOffset, selectionNode, selectionOff
set, ''); |
38 undoTest('android', selectionNode, selectionOffset, selectionNode, selection
Offset, ''); | 38 undoTest('android', selectionNode, selectionOffset, selectionNode, selection
Offset, ''); |
39 } | 39 } |
40 if (window.testRunner) | 40 if (window.testRunner) |
41 document.getElementById('container').outerHTML = ''; | 41 document.getElementById('container').outerHTML = ''; |
42 </script> | 42 </script> |
43 </body> | 43 </body> |
44 </html> | 44 </html> |
OLD | NEW |