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

Unified Diff: LayoutTests/editing/spelling/editing-multiple-words-with-markers.html

Issue 906193003: shouldBecomeEqual() behaves as shouldBe() if the testing expression returns the expected value Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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/editing-multiple-words-with-markers.html
diff --git a/LayoutTests/editing/spelling/editing-multiple-words-with-markers.html b/LayoutTests/editing/spelling/editing-multiple-words-with-markers.html
new file mode 100644
index 0000000000000000000000000000000000000000..83ab72f799ec5fe13b94ef00f5d72f395cd8e13d
--- /dev/null
+++ b/LayoutTests/editing/spelling/editing-multiple-words-with-markers.html
@@ -0,0 +1,97 @@
+<html>
+<head>
+<script src="resources/util.js"></script>
+<script src="../editing.js"></script>
+<title>Editing multiple words with markers test</title>
+</head>
+<body>
+<textarea id="testElement"></textarea>
+<script src="../../resources/js-test.js"></script>
+<script>
+description('The test verifies if the spelling markers disappear when '
+ + 'the multiple misspelled words are concatenated by delete command. '
+ + 'To test manually, type "it\'s a meagesga meagesga ", then '
+ + 'select and delete "esga meag". The test succeeds '
+ + 'if the remaining text does not have any underline.');
+
+jsTestIsAsync = true;
+
+if (window.internals) {
+ internals.settings.setUnifiedTextCheckerEnabled(true);
+ internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
+function resetText() {
+ var textArea = document.getElementById('testElement');
+ textArea.value = "";
+ typeText(textArea, "it's a meagesga meagesga ");
please use gerrit instead 2015/02/10 22:55:42 This test will be flaky if you don't wait for spel
grzegorz 2015/02/11 10:54:23 Done.
grzegorz 2015/02/11 11:53:28 The problem here is a little complicated. Waiting
+}
+
+/**
+ * Those test cases verify if spelling markes disappear when
please use gerrit instead 2015/02/10 22:55:42 s/markes/markers/
grzegorz 2015/02/11 10:54:23 Done.
+ * the multiple misspelled words are concatenated by delete command.
+ *
+ * '+' means the position where marker is expected.
+ * '-' means the position where marker is _not_ expected.
+ */
+var testCases = [
+
+ { selectionRange: null, spellingMarker1: [ 0, 4, 'false' ], spellingMarker2: [ 7, 8, 'true' ]
+ // it's a meagesga meagesga
+ // ---- ++++++++
+ },
+ { selectionRange: [ 11, 20 ], spellingMarker1: [ 7, 4, 'false' ], spellingMarker2: [ 11, 4, 'false' ]
+ // it's a meagesga
+ // --------
+ },
+ { selectionRange: [ 11, 16 ], spellingMarker1: [ 7, 4, 'false' ], spellingMarker2: [ 11, 8, 'false' ]
+ // it's a meagmeagesga
+ // ------------
+ },
+ { selectionRange: [ 15, 20 ], spellingMarker1: [ 7, 8, 'false' ], spellingMarker2: [ 15, 4, 'false' ]
+ // it's a meagesgaesga
+ // ------------
+ }
+];
+
+var marker1, marker2;
+
+function checkSpellingMarkerAfterDeleteingSelection(selectionRange, spellingMarker1, spellingMarker2) {
+ resetText();
+ var testElement = document.getElementById('testElement');
+
+ if (selectionRange) {
+ testElement.setSelectionRange(selectionRange[0], selectionRange[1]);
+ execDeleteCommand();
+ }
+
+ if (!window.internals)
+ return done();
please use gerrit instead 2015/02/10 22:55:42 If window.internals is not defined, this statement
grzegorz 2015/02/11 10:54:23 Done.
+
+ debug(testElement.value);
please use gerrit instead 2015/02/10 22:55:42 Is debugging necessary here?
grzegorz 2015/02/11 10:54:23 It adds empty line in the output.
+
+ marker1 = spellingMarker1;
+ marker2 = spellingMarker2;
+
+ shouldBecomeEqual('internals.hasSpellingMarker(document, marker1[0], marker1[1])', marker1[2], function() {
+ shouldBecomeEqual('internals.hasSpellingMarker(document, marker2[0], marker2[1])', marker2[2], function() {
+ debug("");
please use gerrit instead 2015/02/10 22:55:42 Is debugging necessary here?
grzegorz 2015/02/11 10:54:22 Ditto.
+ done();
+ });
+ });
+}
+
+function done() {
+ var nextTestCase = testCases.shift();
+ if (nextTestCase)
please use gerrit instead 2015/02/10 22:55:42 I would feel better if you put curly braces around
grzegorz 2015/02/11 10:54:23 Done.
+ return setTimeout(checkSpellingMarkerAfterDeleteingSelection, 0,
please use gerrit instead 2015/02/10 22:55:42 Why setTimeout(func, 0, args) instead of simply fu
grzegorz 2015/02/11 10:54:23 I can change it if you like.
+ nextTestCase.selectionRange,
+ nextTestCase.spellingMarker1,
+ nextTestCase.spellingMarker2);
+
+ finishJSTest();
+}
+done();
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698