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

Unified Diff: third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp

Issue 2691433002: Make Blink support multiline text insertion (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/TypingCommand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
index 508d4d8cff40b2e305cff326a20f3707818ef89a..08adabef0c14e7bbf32d800869e6525ce3190d9c 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -309,6 +309,29 @@ TEST_F(InputMethodControllerTest, CommitTextKeepingStyle) {
EXPECT_STREQ("abc1<b>2</b>37<b>8</b>9", div->innerHTML().utf8().data());
}
+TEST_F(InputMethodControllerTest, InsertTextWithNewLine) {
+ Element* div =
+ insertHTMLElement("<div id='sample' contenteditable></div>", "sample");
+ Vector<CompositionUnderline> underlines;
+ underlines.push_back(CompositionUnderline(0, 11, Color(255, 0, 0), false, 0));
+
+ controller().commitText(String("hello\nworld"), underlines, 0);
+ EXPECT_STREQ("hello<div>world</div>", div->innerHTML().utf8().data());
+}
+
+TEST_F(InputMethodControllerTest, InsertTextWithNewLineIncrementally) {
+ Element* div =
+ insertHTMLElement("<div id='sample' contenteditable></div>", "sample");
+
+ Vector<CompositionUnderline> underlines;
+ underlines.push_back(CompositionUnderline(0, 11, Color(255, 0, 0), false, 0));
+ controller().setComposition("foo", underlines, 0, 2);
+ EXPECT_STREQ("foo", div->innerHTML().utf8().data());
+
+ controller().commitText(String("hello\nworld"), underlines, 0);
+ EXPECT_STREQ("hello<div>world</div>", div->innerHTML().utf8().data());
+}
+
TEST_F(InputMethodControllerTest, SelectionOnConfirmExistingText) {
insertHTMLElement("<div id='sample' contenteditable>hello world</div>",
"sample");
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/TypingCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698