Index: third_party/WebKit/LayoutTests/editing/execCommand/5080333-1.html |
diff --git a/third_party/WebKit/LayoutTests/editing/execCommand/5080333-1.html b/third_party/WebKit/LayoutTests/editing/execCommand/5080333-1.html |
index eac346a0ee2290633cad6d3adef842ff708ba664..4423d95cb2e8e6449a8bcb70ffea703310fe6313 100644 |
--- a/third_party/WebKit/LayoutTests/editing/execCommand/5080333-1.html |
+++ b/third_party/WebKit/LayoutTests/editing/execCommand/5080333-1.html |
@@ -1,13 +1,23 @@ |
+<!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 caret 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'); |
-sel.collapse(div, 0); |
-sel.modify("move", "forward", "paragraphBoundary"); |
-sel.modify("move", "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_true(selection.isCollapsed); |
+ assert_equals(selection.anchorNode, div.childNodes[2]); |
+ assert_equals(selection.anchorOffset, 0); |
+}); |
</script> |