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

Side by Side Diff: LayoutTests/editing/deleting/delete-br-001.html

Issue 18884002: Make editing/deleting/delete-br-00[1-7].html platform independent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/editing/deleting/delete-br-001-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <body>
2 <head> 2 <div id="container">
3 <div contenteditable="true" id="work"></div>
4 </div>
5 </div>
6 <script src="../../fast/js/resources/js-test-pre.js"></script>
7 <script>
8 function $(id) { return document.getElementById(id); }
3 9
4 <style> 10 var sampleHTML = 'abc<br id="a"><br id="b"><br id="c">def';
5 .editing { 11 var selection = window.getSelection();
6 border: 2px solid red; 12 function testIt(nth, numberOfDeletes, expectedOffset, expectedHTML) {
7 padding: 12px; 13 $('work').innerHTML = sampleHTML;
8 font-size: 24px; 14 var range = document.createRange();
9 } 15 range.setStartAfter($('work').querySelectorAll('br')[nth]);
10 </style> 16 selection.removeAllRanges();
11 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script > 17 selection.addRange(range);
12 18 for (var i = 0; i < numberOfDeletes; ++i)
13 <script> 19 document.execCommand('Delete');
14 20 shouldBeEqualToString('$("work").innerHTML', expectedHTML);
15 function editingTest() { 21 shouldBeEqualToString('selection.type', 'Caret');
16 for (i = 0; i < 21; i++) { 22 shouldBe('selection.anchorOffset', expectedOffset + '');
17 moveSelectionForwardByCharacterCommand();
18 }
19 deleteCommand();
20 } 23 }
21 24
25 testIt(0, 1, 3, 'abc<br id="b"><br id="c">def');
26 testIt(1, 1, 2, 'abc<br id="a"><br>def');
27 testIt(2, 1, 0, 'abc<br id="a"><br id="b">def');
28 testIt(1, 2, 3, 'abc<br>def');
29 testIt(2, 2, 0, 'abc<br id="a">def');
30 testIt(2, 3, 3, 'abcdef');
31
32 if (window.testRunner)
33 $('container').outerHTML = '';
34 else
35 $('work').innerHTML = sampleHTML;
22 </script> 36 </script>
23 37 <script src="../../fast/js/resources/js-test-post.js"></script>
24 <title>Editing Test</title>
25 </head>
26 <body>
27 <div contenteditable id="root" class="editing">
28 <span id="test">Fourscore
29 and seven <br>years ago</span>
30 </div>
31
32 <script>
33 runEditingTest();
34 </script>
35
36 </body> 38 </body>
37 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/editing/deleting/delete-br-001-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698