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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/inserting/edited-whitespace-1.html

Issue 2937783003: Rewrite editing/inserting/edited-whitespace-1.html to utilize assert_selection() (Closed)
Patch Set: 2017-06-14T15:25:45 Created 3 years, 6 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/platform/linux/editing/inserting/edited-whitespace-1-expected.png » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <p>This tests that edited whitespaces aren't all nbsps. When the region becomes non-editable, Hello and World should still be on different lines. This demonst rates a bug: the div's focus halo doesn't go away when it becomes non-editable.< /p> 1 <!doctype html>
2 <div id="div" contenteditable="true" style="border: 1px solid black; width: 60px ;"></div> 2 <script src="../../resources/testharness.js"></script>
3 <ol id="console"></ol> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../assert_selection.js"></script>
4 <script> 5 <script>
5 function log(str) { 6 test(() => assert_selection(
6 var li = document.createElement("li"); 7 '<div contenteditable>|</div>',
7 li.appendChild(document.createTextNode(str)); 8 selection => {
8 var console = document.getElementById("console"); 9 selection.document.execCommand('InsertText', false, ' ');
9 console.appendChild(li); 10 selection.document.execCommand('InsertText', false, 'Hello');
10 } 11 selection.document.execCommand('InsertText', false, ' ');
11 12 selection.document.execCommand('InsertText', false, ' ');
12 if (window.testRunner) 13 selection.document.execCommand('InsertText', false, ' ');
13 testRunner.waitUntilDone(); 14 selection.document.execCommand('InsertText', false, ' ');
14 15 selection.document.execCommand('InsertText', false, ' ');
15 var div = document.getElementById("div"); 16 selection.document.execCommand('InsertText', false, 'World');
16 var sel = window.getSelection(); 17 selection.document.execCommand('InsertText', false, ' ');
17 sel.collapse(div, 0); 18 },
18 document.execCommand("InsertText", false, " "); 19 [
19 document.execCommand("InsertText", false, "Hello"); 20 '<div contenteditable>',
20 document.execCommand("InsertText", false, " "); 21 '\u00A0Hello \u00A0 \u00A0 World\u00A0',
21 document.execCommand("InsertText", false, " "); 22 '|</div>',
22 document.execCommand("InsertText", false, " "); 23 ].join('')),
23 document.execCommand("InsertText", false, " "); 24 'insert " Hello World " with extra whitespaces');
24 document.execCommand("InsertText", false, " ");
25 document.execCommand("InsertText", false, "World");
26 document.execCommand("InsertText", false, " ");
27
28 var innerText = div.innerHTML;
29
30 // Check the pattern produced. This might change in the future.
31 var expected = "&nbsp;Hello &nbsp; &nbsp; World&nbsp;";
32 var nbsp = false;
33 for (var i = 0; i < innerText.length; i++) {
34 if(innerText[i] != expected[i])
35 log("Error: Character " + i + " of the editable region was not what was e xpected.");
36 }
37
38 div.contentEditable = "false";
39 // When we turn content editability off, we'll see Hello and World on the same l ine if editing is using all nbsps.
40
41 // Ensure we push a final frame to avoid flake.
42 if (window.testRunner) {
43 window.requestAnimationFrame(function() {
44 testRunner.notifyDone();
45 });
46 }
47 </script> 25 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/platform/linux/editing/inserting/edited-whitespace-1-expected.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698