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> |