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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..71dadc0c95628a2687c9cff4a825c4fa59138b85 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 = "&nbsp;Hello &nbsp; &nbsp; World&nbsp;";
-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>|</div>',
+ 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>',
+ '\u00A0Hello \u00A0 \u00A0 World\u00A0',
+ '|</div>',
+ ].join('')),
+ 'insert " Hello World " with extra whitespaces');
</script>
« 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