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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/undo/undo-smart-delete-word.html

Issue 1625423002: Make undo-smart-delete-word.html to use w3c test harness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-01-25T17:47:28 Settings.SelectTrailingWhitespace Created 4 years, 11 months 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/undo/undo-smart-delete-word-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <!DOCTYPE html>
2 <head> 2 <script src="../../resources/testharness.js"></script>
3 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script > 3 <script src="../../resources/testharnessreport.js"></script><html>
4 <div class="scenario">
5 Tests:
6 <br>
7 Select a word via double-click. Delete. Then undo the delete. The space that got
8 smart deleted should now be selected.
9 </div>
10 </div>
4 11
12 <div contenteditable id="root">
13 foo <span id="word">bar</span> baz
14 </div>
15 <div id="log"></div>
5 <script> 16 <script>
6 if (window.testRunner) 17 test(function() {
7 testRunner.dumpAsText(); 18 if (!window.eventSender || !window.internals) {
19 assert_unreached('This test requires eventSender and internals.');
20 return;
21 }
22 // Make double-click to select trailing whitespace too.
23 internals.settings.setEditingBehavior('win');
24 internals.settings.setSelectTrailingWhitespaceEnabled(true);
8 25
9 function editingTest() { 26 // Select "bar "
10 var word = document.getElementById("word"); 27 var word = document.getElementById('word');
11 var x = word.offsetLeft; 28 var x = word.offsetLeft;
12 var y = word.offsetTop; 29 var y = word.offsetTop;
13 eventSender.mouseMoveTo(x, y); 30 eventSender.mouseMoveTo(x, y);
14 eventSender.mouseDown(); 31 eventSender.mouseDown();
15 eventSender.mouseUp(); 32 eventSender.mouseUp();
16 eventSender.mouseDown(); 33 eventSender.mouseDown();
17 eventSender.mouseUp(); 34 eventSender.mouseUp();
18 35
19 document.execCommand("Delete"); 36 document.execCommand('Delete');
20 document.execCommand("Undo"); 37 document.execCommand('Undo');
21 38
22 var selection = window.getSelection(); 39 var selection = window.getSelection();
23 if (selection.anchorNode != document.getElementById("root").firstChild || 40 assert_equals(selection.anchorNode, word.firstChild, 'anchorNode');
24 selection.anchorOffset != 4 || 41 assert_equals(selection.anchorOffset, 0, 'anchorOffset');
25 selection.focusNode != word.firstChild || 42 assert_equals(selection.focusNode, word.nextSibling, 'focusNode');
26 selection.focusOffset != 3) { 43 assert_equals(selection.focusOffset, 1, 'focusOffset');
27 document.getElementById("result").innerHTML = "FAILED"; 44 });
28 console.log(selection.anchorNode);
29 console.log(selection.anchorOffset);
30 console.log(selection.focusNode);
31 console.log(selection.focusOffset);
32 } else
33 document.getElementById("result").innerHTML = "PASSED";
34 }
35
36 </script> 45 </script>
37 </head>
38 <body>
39
40 <div class="explanation">
41 <div class="scenario">
42 Tests:
43 <br>
44 Select a word via double-click. Delete. Then undo the delete. The space that got smart deleted should now be selected.
45 </div>
46 </div>
47
48 <div contenteditable id="root">
49 foo <span id="word">bar</span> baz
50 </div>
51
52 <div id="result"></div>
53 <script>
54 editingTest();
55 </script>
56
57 </body>
58 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/undo/undo-smart-delete-word-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698