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

Unified Diff: third_party/WebKit/LayoutTests/editing/spelling/grammar-paste.html

Issue 2188703002: Remove layout tests only for grammar checking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/editing/spelling/grammar-paste.html
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/grammar-paste.html b/third_party/WebKit/LayoutTests/editing/spelling/grammar-paste.html
deleted file mode 100644
index 73f2f1af72187f6302f0500b19dd1fda8baa6750..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/editing/spelling/grammar-paste.html
+++ /dev/null
@@ -1,139 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-<script>
-description('Grammar checking for pasted text.');
-
-jsTestIsAsync = true;
-
-var testRoot = document.createElement("div");
-document.body.insertBefore(testRoot, document.body.firstChild);
-
-var testTextArea = document.createElement("textarea");
-testRoot.appendChild(testTextArea);
-
-var testInput = document.createElement("input");
-testInput.setAttribute("type", "text");
-testRoot.appendChild(testInput);
-
-var testEditable = document.createElement("div");
-testEditable.setAttribute("contentEditable", "true");
-testRoot.appendChild(testEditable);
-
-var testSourcePlain = document.createElement("div");
-testSourcePlain.innerHTML = "You has the right.";
-testRoot.appendChild(testSourcePlain);
-
-var testSourceDecorated = document.createElement("div");
-testSourceDecorated.innerHTML = "I have a<b>n ki</b>wi. I have no idea.";
-testRoot.appendChild(testSourceDecorated);
-
-var testSourceMulti = document.createElement("div");
-testSourceMulti.innerHTML = "I have an grape. I have an muscat. I don't know.";
-testRoot.appendChild(testSourceMulti);
-
-var sel = window.getSelection();
-
-var tests = [];
-
-function done()
-{
- var next = tests.shift();
- if (next)
- return window.setTimeout(next, 0);
- testRoot.style.display = "none";
- finishJSTest();
-}
-
-function findFirstTextNode(node)
-{
- function iterToFindFirstTextNode(node)
- {
- if (node instanceof Text)
- return node;
-
- var childNodes = node.childNodes;
- for (var i = 0; i < childNodes.length; ++i) {
- var n = iterToFindFirstTextNode(childNodes[i]);
- if (n)
- return n;
- }
-
- return null;
- }
-
-
- if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement)
- return iterToFindFirstTextNode(internals.shadowRoot(node));
- else
- return iterToFindFirstTextNode(node);
-}
-
-function verifyMarker(node, expectedMarked)
-{
- if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement)
- node.focus();
- else
- sel.selectAllChildren(node);
-
- var textNode = findFirstTextNode(node);
- var num = internals.markerCountForNode(textNode, "grammar");
- if (num != expectedMarked.length)
- return false;
- for (var i = 0; i < num; ++i) {
- var range = internals.markerRangeForNode(textNode, "grammar", i);
- if (range.toString() != expectedMarked[i])
- return false;
- }
-
- var nodeContent = node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement ? node.value : node.innerHTML;
- testPassed(node.tagName + " ungrammatical phrase '" + expectedMarked + "' on '" + nodeContent + "'");
-
- return true;
-}
-
-var destination = null;
-var expectedMarked = null;
-function pasteAndVerify(source, dest, expectedMarked)
-{
- sel.selectAllChildren(source);
- document.execCommand("Copy");
- if (dest instanceof HTMLInputElement || dest instanceof HTMLTextAreaElement) {
- dest.value = "";
- dest.focus();
- } else {
- dest.innerHTML = "";
- sel.selectAllChildren(dest);
- }
- document.execCommand("Paste");
-
- if (window.internals) {
- destination = dest;
- ungrammaticalPhrase = expectedMarked;
- shouldBecomeEqual('verifyMarker(destination, ungrammaticalPhrase)', 'true', done);
- }
-};
-
-tests.push(function() { pasteAndVerify(testSourcePlain, testEditable, ["has"]); });
-tests.push(function() { pasteAndVerify(testSourceDecorated, testEditable, ["a"]); }); // Checks only 'a'.
-tests.push(function() { pasteAndVerify(testSourceMulti, testEditable, ["an", "an"]); });
-
-tests.push(function() { pasteAndVerify(testSourcePlain, testInput, ["has"]); });
-tests.push(function() { pasteAndVerify(testSourceDecorated, testInput, ["an"]); });
-tests.push(function() { pasteAndVerify(testSourceMulti, testInput, ["an", "an"]); });
-
-tests.push(function() { pasteAndVerify(testSourcePlain, testTextArea, ["has"]); });
-tests.push(function() { pasteAndVerify(testSourceDecorated, testTextArea, ["an"]); });
-tests.push(function() { pasteAndVerify(testSourceMulti, testTextArea, ["an", "an"]); });
-
-done();
-
-var successfullyParsed = true;
-</script>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698