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

Unified Diff: third_party/WebKit/LayoutTests/editing/inserting/return-key-with-selection-002.html

Issue 1456333002: Make layout tests in editing/inserting to use w3c test harness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2015-11-19T14:56:35 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/inserting/return-key-with-selection-002.html
diff --git a/third_party/WebKit/LayoutTests/editing/inserting/return-key-with-selection-002.html b/third_party/WebKit/LayoutTests/editing/inserting/return-key-with-selection-002.html
index 5fa9871997f3eda789e2cf1985b65e129f8ab11d..fae10c13a2f655fa232dbb3a96b3b968fcbf5036 100644
--- a/third_party/WebKit/LayoutTests/editing/inserting/return-key-with-selection-002.html
+++ b/third_party/WebKit/LayoutTests/editing/inserting/return-key-with-selection-002.html
@@ -1,38 +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() {
- moveSelectionForwardByLineCommand();
- extendSelectionForwardByLineCommand();
- extendSelectionForwardByCharacterCommand();
- insertParagraphCommand();
-}
-
-</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:
@@ -43,20 +11,29 @@ A scenario I thought of based on my experiences with this bug:
<div class="expected-results">
Expected Results:
<br>
-Should see this content in the red box below (note that the insertion point should be at the start of the third line, immediately preceding "baz"):
+Should see this content in the box below (note that the insertion point should be at the start of the third line, immediately preceding "baz"):
<div>foo</div><div><br></div><div>baz</div>
</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">
-<div>foo</div><div>bar</div><div>bbaz</div>
-</div>
+<div id="sample" class="editing"><div>foo</div><div>bar</div><div id="baz">bbaz</div></div>
</div>
-
+<div id="log"></div>
<script>
-runEditingTest();
+test(function() {
+ var selection = window.getSelection();
+ var sample = document.getElementById('sample');
+
+ selection.collapse(sample, 0);
+ selection.modify('move', 'forward', 'line');
+ selection.modify('extend', 'forward', 'line');
+ selection.modify('extend', 'forward', 'character');
+ document.execCommand('insertParagraph');
+
+ assert_equals(sample.innerHTML, '<div>foo</div><div><br></div><div>baz<br></div>');
+ assert_true(selection.isCollapsed);
+ assert_equals(selection.anchorNode, sample.childNodes[2].firstChild);
+ assert_equals(selection.anchorOffset, 0);
+});
</script>
-
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698