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

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

Issue 2529803002: [Editing] Let InputMethodController::hasComposition check Range::isConnected(). (Closed)
Patch Set: Move to InputMethodConrollerTest Created 4 years, 1 month 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 | « third_party/WebKit/Source/core/editing/InputMethodController.cpp ('k') | no next file » | 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 437d2a0aa0765006a04a411dd164cf36052051d4..f9502ff3eb02b63581dbe0c1a107db6f26a00fae 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -1062,4 +1062,25 @@ TEST_F(InputMethodControllerTest, CompositionEndEventWithNoSelection) {
EXPECT_TRUE(controller().getSelectionOffsets().isNull());
}
+TEST_F(InputMethodControllerTest, FinishCompositionRemovedRange) {
+ Element* inputA =
+ insertHTMLElement("<input id='a' /><br><input type='tel' id='b' />", "a");
+
+ EXPECT_EQ(WebTextInputTypeText, controller().textInputType());
+
+ // The test requires non-empty composition.
+ controller().setComposition("hello", Vector<CompositionUnderline>(), 5, 5);
+ EXPECT_EQ(WebTextInputTypeText, controller().textInputType());
+
+ // Remove element 'a'.
+ inputA->setOuterHTML("", ASSERT_NO_EXCEPTION);
+ EXPECT_EQ(WebTextInputTypeNone, controller().textInputType());
+
+ document().getElementById("b")->focus();
+ EXPECT_EQ(WebTextInputTypeTelephone, controller().textInputType());
+
+ controller().finishComposingText(InputMethodController::KeepSelection);
+ EXPECT_EQ(WebTextInputTypeTelephone, controller().textInputType());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/InputMethodController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698