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 d1ab143fc6f408b06fe77d36abd4f6e19aff174e..e1e4767b60d3a2c85ebe7163c1c8ff42f6d00a1e 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/FrameView.h" |
#include "core/frame/LocalFrame.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 |