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

Unified Diff: LayoutTests/editing/spelling/spellcheck-editable-on-focus.html

Issue 21694005: Spell check whole content of an editable element when it gets focused. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
diff --git a/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html b/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
new file mode 100644
index 0000000000000000000000000000000000000000..1c5ae0bfa6ca187cb2f88171fc0c3217d35deb41
--- /dev/null
+++ b/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../editing.js"></script>
+<script src="resources/util.js"></script>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body onload="test();">
+<pre id="console"></pre>
+<div id="container">
+ <div id="test_editable" contentEditable>zz zz zz.</div>
+ <textarea>zz zz zz.</textarea>
please use gerrit instead 2013/08/02 16:48:46 Could you please add <input type="text"> here, too
+</div>
+<script>
+description("Spell checking should be triggered on focus of an editable. " +
+"To test manually type focus above editable and textarea. Misspellings in them " +
+"should be marked on focus.");
+
+var testEditable = document.getElementById('test_editable');
+var testTextArea = document.getElementsByTagName('textarea')[0];
please use gerrit instead 2013/08/02 16:48:46 It's best to be consistent. Assign an id to the te
+
+function test()
+{
+ if (!window.internals)
+ {
+ document.getElementById("console").innerHTML = "Automatic testing impossible. Test manually.\n";
please use gerrit instead 2013/08/02 16:48:46 There's an easier way to write this: log("Autom
+ return;
+ }
+
+ function waitForMarkersToAppear(node, nretry)
+ {
+ if (nretry && !internals.markerCountForNode(node, "spelling")) {
+ window.setTimeout(function() { waitForMarkersToAppear(node, nretry - 1); }, 0);
+ }
+ }
+
+ waitForMarkersToAppear(findFirstTextNode(testEditable), 10);
+ shouldBe('internals.markerCountForNode(findFirstTextNode(testEditable), "spelling")', '0');
+ testEditable.focus();
+ waitForMarkersToAppear(findFirstTextNode(testEditable), 10);
+ shouldBe('internals.markerCountForNode(findFirstTextNode(testEditable), "spelling")', '3');
+ waitForMarkersToAppear(findFirstTextNode(testTextArea), 10);
+ shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spelling")', '0');
+ testTextArea.focus();
+ waitForMarkersToAppear(findFirstTextNode(testTextArea), 10);
+ shouldBe('internals.markerCountForNode(findFirstTextNode(testTextArea), "spelling")', '3');
+}
+
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/editing/spelling/spellcheck-editable-on-focus-expected.txt » ('j') | Source/core/editing/Editor.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698