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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/pasteboard/4242293-1.html

Issue 1462823002: Make layout tests in editing/pasteboard to use w3c test harness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2015-11-20T10:44:42 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 <script src="../../resources/dump-as-markup.js"></script> 1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 This test ensures that createMarkup puts an interchange newline on the
5 pasteboard for a selection ending at the end of a block.
6
2 <div id="copy" contenteditable="true"><div><div>foo</div>bar</div>baz</div> 7 <div id="copy" contenteditable="true"><div><div>foo</div>bar</div>baz</div>
3 <div id="paste" contenteditable="true">foo</div> 8 <div id="sample" contenteditable="true">foo</div>
9 <div id="log"></div>
4 <script> 10 <script>
5 if (window.testRunner) 11 test(function() {
6 testRunner.dumpEditingCallbacks(); 12 if (window.internals)
7 if (window.internals) 13 internals.settings.setEditingBehavior('win');
8 internals.settings.setEditingBehavior('mac');
9 14
10 var sel = window.getSelection(); 15 var selection = window.getSelection();
11 var e = document.getElementById("copy"); 16 selection.collapse(document.getElementById('copy'), 0);
12 sel.collapse(e, 0); 17 selection.modify('move', 'forward', 'word');
13 sel.modify("move", "forward", "word"); 18 selection.modify('extend', 'forward', 'line');
14 sel.modify("extend", "forward", "line"); 19 selection.modify('extend', 'forward', 'line');
15 sel.modify("extend", "forward", "line"); 20 document.execCommand('copy');
16 document.execCommand("Copy");
17 21
18 e = document.getElementById("paste"); 22 var sample = document.getElementById('sample');
19 sel.collapse(e, 0); 23 selection.collapse(sample, 0);
20 sel.modify("move", "forward", "word"); 24 selection.modify('move', 'forward', 'word');
21 document.execCommand("Paste"); 25 document.execCommand('paste');
22 26
23 Markup.description('This test ensures that createMarkup puts an interchange newl ine on the pasteboard for a selection ending at the end of a block. Both region s below should be visually identical.') 27 assert_equals(sample.innerHTML, 'foobar<br>baz');
24 Markup.dump('copy', 'first region (bar and baz are copied)'); 28 assert_true(selection.isCollapsed);
25 Markup.dump('paste', 'second region (bar and baz are pasted)'); 29 assert_equals(selection.anchorNode, sample.lastChild);
30 assert_equals(selection.anchorOffset, 3);
31 });
26 </script> 32 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698