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> |