Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/editing/inserting/edited-whitespace-1.html |
| diff --git a/third_party/WebKit/LayoutTests/editing/inserting/edited-whitespace-1.html b/third_party/WebKit/LayoutTests/editing/inserting/edited-whitespace-1.html |
| index 5ecbfd1dc50a6501308352e7505385d5710c7cdf..4fd650ec46d4be8273950e3fa635ef2e77be1603 100644 |
| --- a/third_party/WebKit/LayoutTests/editing/inserting/edited-whitespace-1.html |
| +++ b/third_party/WebKit/LayoutTests/editing/inserting/edited-whitespace-1.html |
| @@ -1,47 +1,25 @@ |
| -<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 demonstrates a bug: the div's focus halo doesn't go away when it becomes non-editable.</p> |
| -<div id="div" contenteditable="true" style="border: 1px solid black; width: 60px;"></div> |
| -<ol id="console"></ol> |
| +<!doctype html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script src="../assert_selection.js"></script> |
| <script> |
| -function log(str) { |
| - var li = document.createElement("li"); |
| - li.appendChild(document.createTextNode(str)); |
| - var console = document.getElementById("console"); |
| - console.appendChild(li); |
| -} |
| - |
| -if (window.testRunner) |
| - testRunner.waitUntilDone(); |
| - |
| -var div = document.getElementById("div"); |
| -var sel = window.getSelection(); |
| -sel.collapse(div, 0); |
| -document.execCommand("InsertText", false, " "); |
| -document.execCommand("InsertText", false, "Hello"); |
| -document.execCommand("InsertText", false, " "); |
| -document.execCommand("InsertText", false, " "); |
| -document.execCommand("InsertText", false, " "); |
| -document.execCommand("InsertText", false, " "); |
| -document.execCommand("InsertText", false, " "); |
| -document.execCommand("InsertText", false, "World"); |
| -document.execCommand("InsertText", false, " "); |
| - |
| -var innerText = div.innerHTML; |
| - |
| -// Check the pattern produced. This might change in the future. |
| -var expected = " Hello World "; |
| -var nbsp = false; |
| -for (var i = 0; i < innerText.length; i++) { |
| - if(innerText[i] != expected[i]) |
| - log("Error: Character " + i + " of the editable region was not what was expected."); |
| -} |
| - |
| -div.contentEditable = "false"; |
| -// When we turn content editability off, we'll see Hello and World on the same line if editing is using all nbsps. |
| - |
| -// Ensure we push a final frame to avoid flake. |
| -if (window.testRunner) { |
| - window.requestAnimationFrame(function() { |
| - testRunner.notifyDone(); |
| - }); |
| -} |
| +test(() => assert_selection( |
| + '<div contenteditable style="border: 1px solid black; width: 60px;">|</div>', |
|
yoichio
2017/06/14 05:57:10
Is this style needed?
yosin_UTC9
2017/06/14 06:26:49
No, this style doesn't affect test result.
Removed
|
| + selection => { |
| + selection.document.execCommand('InsertText', false, ' '); |
| + selection.document.execCommand('InsertText', false, 'Hello'); |
| + selection.document.execCommand('InsertText', false, ' '); |
| + selection.document.execCommand('InsertText', false, ' '); |
| + selection.document.execCommand('InsertText', false, ' '); |
| + selection.document.execCommand('InsertText', false, ' '); |
| + selection.document.execCommand('InsertText', false, ' '); |
| + selection.document.execCommand('InsertText', false, 'World'); |
| + selection.document.execCommand('InsertText', false, ' '); |
| + }, |
| + [ |
| + '<div contenteditable style="border: 1px solid black; width: 60px;">', |
| + '\u00A0Hello \u00A0 \u00A0 World\u00A0', |
| + '|</div>', |
| + ].join('')), |
| + 'insert " Hello World " with extra whitespaces'); |
| </script> |