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

Unified Diff: third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-007.html

Issue 1462823002: Make layout tests in editing/pasteboard to use w3c test harness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2015-11-20T10:44:42 Created 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-007.html
diff --git a/third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-007.html b/third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-007.html
index 8b7de9d52a901e67ab4e4979dcf889d067843aab..d1dd039578208a39986e655e7036b67b35d6b7cf 100644
--- a/third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-007.html
+++ b/third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-007.html
@@ -1,43 +1,6 @@
-<html>
-<head>
-
-<style>
-.editing {
- border: 2px solid red;
- font-size: 24px;
-}
-.explanation {
- border: 2px solid blue;
- padding: 12px;
- font-size: 24px;
- margin-bottom: 24px;
-}
-.scenario { margin-bottom: 16px;}
-.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
-.expected-results:first-line { font-weight: bold }
-</style>
-<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
-
-<script>
-
-function editingTest() {
- var target = document.getElementById('test');
- var x = target.offsetLeft;
- var y = target.offsetTop + target.offsetHeight / 2;
- doubleClick(x, y);
- cutCommand();
- typeCharacterCommand('.');
- typeCharacterCommand('.');
- moveSelectionBackwardByCharacterCommand();
- pasteCommand();
-}
-
-</script>
-
-<title>Editing Test</title>
-</head>
-<body>
-
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<div class="explanation">
<div class="scenario">
Tests:
@@ -53,15 +16,35 @@ A space should be added before, but not after the pasted word. It should look li
</div>
</div>
-<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
-<div id="test" class="editing">
-test
-</div>
-</div>
-
+<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;"><div id="sample">test</div></div>
+<div id="log"></div>
<script>
-runEditingTest();
+test(function() {
+ if (!window.internals && !window.eventSender)
+ return;
+
+ internals.settings.setEditingBehavior('win');
+
+ var selection = window.getSelection();
+ var sample = document.getElementById('sample');
+
+ var x = sample.offsetLeft;
+ var y = sample.offsetTop + sample.offsetHeight / 2;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+
+ document.execCommand('cut');
+ document.execCommand('insertText', false, '.');
+ document.execCommand('insertText', false, '.');
+ selection.modify('move', 'backward', 'character');
+ document.execCommand('paste');
+
+ assert_equals(sample.innerHTML, '. test.');
+ assert_true(selection.isCollapsed, 'isCollapsed');
+ assert_equals(selection.anchorNode, sample.firstChild, 'anchorNode');
+ assert_equals(selection.anchorOffset, 6, 'anchorOffset');
+});
</script>
-
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698