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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/undo/undo-smart-delete-word.html
diff --git a/third_party/WebKit/LayoutTests/editing/undo/undo-smart-delete-word.html b/third_party/WebKit/LayoutTests/editing/undo/undo-smart-delete-word.html
index 4f576dc76973b75c1cec2774609919d63843744b..dcaef06c5152ff000eedf20ec75b275527686981 100644
--- a/third_party/WebKit/LayoutTests/editing/undo/undo-smart-delete-word.html
+++ b/third_party/WebKit/LayoutTests/editing/undo/undo-smart-delete-word.html
@@ -1,13 +1,30 @@
-<html>
-<head>
-<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script><html>
+<div class="scenario">
+Tests:
+<br>
+Select a word via double-click. Delete. Then undo the delete. The space that got
+smart deleted should now be selected.
+</div>
+</div>
+<div contenteditable id="root">
+foo <span id="word">bar</span> baz
+</div>
+<div id="log"></div>
<script>
-if (window.testRunner)
- testRunner.dumpAsText();
-
-function editingTest() {
- var word = document.getElementById("word");
+test(function() {
+ if (!window.eventSender || !window.internals) {
+ assert_unreached('This test requires eventSender and internals.');
+ return;
+ }
+ // Make double-click to select trailing whitespace too.
+ internals.settings.setEditingBehavior('win');
+ internals.settings.setSelectTrailingWhitespaceEnabled(true);
+
+ // Select "bar "
+ var word = document.getElementById('word');
var x = word.offsetLeft;
var y = word.offsetTop;
eventSender.mouseMoveTo(x, y);
@@ -16,43 +33,13 @@ function editingTest() {
eventSender.mouseDown();
eventSender.mouseUp();
- document.execCommand("Delete");
- document.execCommand("Undo");
-
- var selection = window.getSelection();
- if (selection.anchorNode != document.getElementById("root").firstChild ||
- selection.anchorOffset != 4 ||
- selection.focusNode != word.firstChild ||
- selection.focusOffset != 3) {
- document.getElementById("result").innerHTML = "FAILED";
- console.log(selection.anchorNode);
- console.log(selection.anchorOffset);
- console.log(selection.focusNode);
- console.log(selection.focusOffset);
- } else
- document.getElementById("result").innerHTML = "PASSED";
-}
-
-</script>
-</head>
-<body>
+ document.execCommand('Delete');
+ document.execCommand('Undo');
-<div class="explanation">
-<div class="scenario">
-Tests:
-<br>
-Select a word via double-click. Delete. Then undo the delete. The space that got smart deleted should now be selected.
-</div>
-</div>
-
-<div contenteditable id="root">
-foo <span id="word">bar</span> baz
-</div>
-
-<div id="result"></div>
-<script>
-editingTest();
+ var selection = window.getSelection();
+ assert_equals(selection.anchorNode, word.firstChild, 'anchorNode');
+ assert_equals(selection.anchorOffset, 0, 'anchorOffset');
+ assert_equals(selection.focusNode, word.nextSibling, 'focusNode');
+ assert_equals(selection.focusOffset, 1, 'focusOffset');
+});
</script>
-
-</body>
-</html>
« 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