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

Unified Diff: third_party/WebKit/LayoutTests/editing/execCommand/5080333-2.html

Issue 1459783003: Make layout tests in editing/deleting and editing/execCommand to use w3c test harness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/execCommand/5080333-2.html
diff --git a/third_party/WebKit/LayoutTests/editing/execCommand/5080333-2.html b/third_party/WebKit/LayoutTests/editing/execCommand/5080333-2.html
index c90049d82afc503143233e0acb92d1eb733f7b7f..4d907bfed5c659edd1f8ff11a7f31c588338da07 100644
--- a/third_party/WebKit/LayoutTests/editing/execCommand/5080333-2.html
+++ b/third_party/WebKit/LayoutTests/editing/execCommand/5080333-2.html
@@ -1,14 +1,25 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<p>This tests for a bug where changing the alignment of an image would result in a selection that wasn't the one that was present before the alignment change. The image should be centered and the selection should be the same before and after the operation.</p>
<div id="div" contenteditable="true">foo<br><img src="../resources/abe.png"><br>baz</div>
-
+<div id="log"></div>
<script>
-var div = document.getElementById("div");
-var sel = window.getSelection();
+test(function() {
+ var div = document.getElementById("div");
+ var selection = window.getSelection();
+
+ selection.collapse(div, 0);
+ selection.modify("move", "forward", "paragraphBoundary");
+ selection.modify("move", "forward", "character");
+ selection.modify("extend", "forward", "character");
-sel.collapse(div, 0);
-sel.modify("move", "forward", "paragraphBoundary");
-sel.modify("move", "forward", "character");
-sel.modify("extend", "forward", "character");
+ document.execCommand("JustifyCenter");
-document.execCommand("JustifyCenter");
+ assert_equals(div.innerHTML, 'foo<br><div style="text-align: center;"><img src="../resources/abe.png"></div>baz');
+ assert_equals(selection.anchorNode, div.childNodes[2]);
+ assert_equals(selection.anchorOffset, 0);
+ assert_equals(selection.focusNode, div.childNodes[2]);
+ assert_equals(selection.focusOffset, 1);
+});
</script>

Powered by Google App Engine
This is Rietveld 408576698