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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-007.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 <html> 1 <!DOCTYPE html>
2 <head> 2 <script src="../../resources/testharness.js"></script>
3 3 <script src="../../resources/testharnessreport.js"></script>
4 <style>
5 .editing {
6 border: 2px solid red;
7 font-size: 24px;
8 }
9 .explanation {
10 border: 2px solid blue;
11 padding: 12px;
12 font-size: 24px;
13 margin-bottom: 24px;
14 }
15 .scenario { margin-bottom: 16px;}
16 .scenario:first-line { font-weight: bold; margin-bottom: 16px;}
17 .expected-results:first-line { font-weight: bold }
18 </style>
19 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script >
20
21 <script>
22
23 function editingTest() {
24 var target = document.getElementById('test');
25 var x = target.offsetLeft;
26 var y = target.offsetTop + target.offsetHeight / 2;
27 doubleClick(x, y);
28 cutCommand();
29 typeCharacterCommand('.');
30 typeCharacterCommand('.');
31 moveSelectionBackwardByCharacterCommand();
32 pasteCommand();
33 }
34
35 </script>
36
37 <title>Editing Test</title>
38 </head>
39 <body>
40
41 <div class="explanation"> 4 <div class="explanation">
42 <div class="scenario"> 5 <div class="scenario">
43 Tests: 6 Tests:
44 <br> 7 <br>
45 Smart paste when pasting between two periods. 8 Smart paste when pasting between two periods.
46 </div> 9 </div>
47 <div class="expected-results"> 10 <div class="expected-results">
48 Expected Results: 11 Expected Results:
49 <br> 12 <br>
50 A space should be added before, but not after the pasted word. It should look li ke this: 13 A space should be added before, but not after the pasted word. It should look li ke this:
51 <BR> 14 <BR>
52 . test. 15 . test.
53 </div> 16 </div>
54 </div> 17 </div>
55 18
56 <div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: s pace; -khtml-line-break: after-white-space;"> 19 <div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: s pace; -khtml-line-break: after-white-space;"><div id="sample">test</div></div>
57 <div id="test" class="editing"> 20 <div id="log"></div>
58 test 21 <script>
59 </div> 22 test(function() {
60 </div> 23 if (!window.internals && !window.eventSender)
24 return;
61 25
62 <script> 26 internals.settings.setEditingBehavior('win');
63 runEditingTest(); 27
28 var selection = window.getSelection();
29 var sample = document.getElementById('sample');
30
31 var x = sample.offsetLeft;
32 var y = sample.offsetTop + sample.offsetHeight / 2;
33 eventSender.mouseMoveTo(x, y);
34 eventSender.mouseDown();
35 eventSender.mouseUp();
36 eventSender.mouseDown();
37 eventSender.mouseUp();
38
39 document.execCommand('cut');
40 document.execCommand('insertText', false, '.');
41 document.execCommand('insertText', false, '.');
42 selection.modify('move', 'backward', 'character');
43 document.execCommand('paste');
44
45 assert_equals(sample.innerHTML, '. test.');
46 assert_true(selection.isCollapsed, 'isCollapsed');
47 assert_equals(selection.anchorNode, sample.firstChild, 'anchorNode');
48 assert_equals(selection.anchorOffset, 6, 'anchorOffset');
49 });
64 </script> 50 </script>
65
66 </body>
67 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698