Index: third_party/WebKit/Source/core/editing/spellcheck/SpellCheckerTest.cpp |
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckerTest.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckerTest.cpp |
index 3e393d9debebb8b2f0359a5b99e6cb2aaf27f42e..e4539ef6109f23f32b8ce9ce1c6125f3ac3aedb0 100644 |
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckerTest.cpp |
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckerTest.cpp |
@@ -5,6 +5,8 @@ |
#include "core/editing/spellcheck/SpellChecker.h" |
#include "core/editing/Editor.h" |
+#include "core/editing/markers/DocumentMarkerController.h" |
+#include "core/editing/spellcheck/SpellCheckRequester.h" |
#include "core/editing/spellcheck/SpellCheckTestBase.h" |
#include "core/frame/LocalFrame.h" |
#include "core/frame/LocalFrameView.h" |
@@ -82,4 +84,33 @@ TEST_F(SpellCheckerTest, SpellCheckDoesNotCauseUpdateLayout) { |
EXPECT_EQ(start_count, LayoutCount()); |
} |
+TEST_F(SpellCheckerTest, MarkAndReplaceForHandlesMultipleReplacements) { |
+ SetBodyContent( |
+ "<div contenteditable>" |
+ "spllchck" |
+ "</div>"); |
+ Element* div = GetDocument().QuerySelector("div"); |
+ Node* text = div->firstChild(); |
+ EphemeralRange range_to_check = |
+ EphemeralRange(Position(text, 0), Position(text, 8)); |
+ |
+ SpellCheckRequest* request = SpellCheckRequest::Create(range_to_check, 0); |
+ |
+ TextCheckingResult result; |
+ result.decoration = TextDecorationType::kTextDecorationTypeSpelling; |
+ result.location = 0; |
+ result.length = 8; |
+ result.replacements = Vector<String>({"spellcheck", "spillchuck"}); |
+ |
+ GetDocument().GetFrame()->GetSpellChecker().MarkAndReplaceFor( |
+ request, Vector<TextCheckingResult>({result})); |
+ |
+ ASSERT_EQ(1u, GetDocument().Markers().Markers().size()); |
+ |
+ // The Spelling marker's description should be a newline-separated list of the |
+ // suggested replacements |
+ EXPECT_EQ("spellcheck\nspillchuck", |
+ GetDocument().Markers().Markers()[0]->Description()); |
+} |
+ |
} // namespace blink |