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

Side by Side 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
1 <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 aft er the operation.</p> 4 <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 aft er the operation.</p>
2 <div id="div" contenteditable="true">foo<br><img src="../resources/abe.png"><br> baz</div> 5 <div id="div" contenteditable="true">foo<br><img src="../resources/abe.png"><br> baz</div>
6 <div id="log"></div>
7 <script>
8 test(function() {
9 var div = document.getElementById("div");
10 var selection = window.getSelection();
3 11
4 <script> 12 selection.collapse(div, 0);
5 var div = document.getElementById("div"); 13 selection.modify("move", "forward", "paragraphBoundary");
6 var sel = window.getSelection(); 14 selection.modify("move", "forward", "character");
15 selection.modify("extend", "forward", "character");
7 16
8 sel.collapse(div, 0); 17 document.execCommand("JustifyCenter");
9 sel.modify("move", "forward", "paragraphBoundary");
10 sel.modify("move", "forward", "character");
11 sel.modify("extend", "forward", "character");
12 18
13 document.execCommand("JustifyCenter"); 19 assert_equals(div.innerHTML, 'foo<br><div style="text-align: center;"><img s rc="../resources/abe.png"></div>baz');
20 assert_equals(selection.anchorNode, div.childNodes[2]);
21 assert_equals(selection.anchorOffset, 0);
22 assert_equals(selection.focusNode, div.childNodes[2]);
23 assert_equals(selection.focusOffset, 1);
24 });
14 </script> 25 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698