Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: LayoutTests/editing/undo/undo-delete.html

Issue 43143003: Undo of delete/forward-delete of text should not select the deleted text on non-mac platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Function name modified and Tests/Expectations updated Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 at the end 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 at th e end of 'word'.</p> 6 <p>To test manually, place the cursor at the end 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 at th e end of 'word'.</p>
7 <div id="test" style="border: 2px solid red;" contenteditable>This word should b e selected.</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="../../fast/js/resources/js-test-pre.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('d') + 1; 14 var selectionOffset = selectionNode.data.indexOf('d') + 1;
15 var endOffset = selectionNode.data.indexOf(' ') + 1; 15 var endOffsetMac = selectionNode.data.indexOf(' ') + 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);
21 21
22 selection.collapse(selectionNode, selectionOffset); 22 selection.collapse(selectionNode, selectionOffset);
23 for (var i = 0; i < 4; i++) 23 for (var i = 0; i < 4; i++)
24 document.execCommand('delete'); 24 document.execCommand('delete');
25 document.execCommand('undo'); 25 document.execCommand('undo');
26 26
27 shouldBeEqualToString('selection.anchorNode.data', expectedStartNode.data); 27 shouldBeEqualToString('selection.anchorNode.data', expectedStartNode.data);
28 shouldBe('selection.anchorOffset', expectedStartOffset + ''); 28 shouldBe('selection.anchorOffset', expectedStartOffset + '');
29 shouldBeEqualToString('selection.focusNode.data', expectedEndNode.data); 29 shouldBeEqualToString('selection.focusNode.data', expectedEndNode.data);
30 shouldBe('selection.focusOffset', expectedEndOffset + ''); 30 shouldBe('selection.focusOffset', expectedEndOffset + '');
31 shouldBeEqualToString('selection.toString()', selectedText); 31 shouldBeEqualToString('selection.toString()', selectedText);
32 } 32 }
33 33
34 if (window.internals) { 34 if (window.internals) {
35 undoTest('mac', selectionNode, selectionOffset, selectionNode, endOffset, 'w ord'); 35 undoTest('mac', selectionNode, selectionOffset, selectionNode, endOffsetMac, 'word');
36 undoTest('win', selectionNode, selectionOffset, selectionNode, endOffset, 'w ord'); 36 undoTest('win', selectionNode, selectionOffset, selectionNode, selectionOffs et, '');
37 undoTest('unix', selectionNode, selectionOffset, selectionNode, endOffset, ' word'); 37 undoTest('unix', selectionNode, selectionOffset, selectionNode, selectionOff set, '');
38 undoTest('android', selectionNode, selectionOffset, selectionNode, endOffset , 'word'); 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 <script src="../../fast/js/resources/js-test-post.js"></script> 43 <script src="../../fast/js/resources/js-test-post.js"></script>
44 </body> 44 </body>
45 </html> 45 </html>
OLDNEW
« no previous file with comments | « LayoutTests/editing/undo/undo-combined-delete-expected.txt ('k') | LayoutTests/editing/undo/undo-delete-boundary.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698