From f20c1d81d5d7ef69e7beb7038acf40febe95adaf Mon Sep 17 00:00:00 2001 From: Justin McCandless Date: Fri, 31 Jul 2020 10:16:41 -0700 Subject: [PATCH 1/3] Remove overwriting keyboard type, must have been accidental --- .../darwin/ios/framework/Source/FlutterTextInputPlugin.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index 1e04170da2159..afc341f5ed5dc 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -461,7 +461,6 @@ - (void)configureWithDictionary:(NSDictionary*)configuration { self.secureTextEntry = [configuration[kSecureTextEntry] boolValue]; self.keyboardType = ToUIKeyboardType(inputType); - self.keyboardType = UIKeyboardTypeNamePhonePad; self.returnKeyType = ToUIReturnKeyType(configuration[kInputAction]); self.autocapitalizationType = ToUITextAutoCapitalizationType(configuration); From 6db804c51171947ab02335dedbc6c5b2c1643aa8 Mon Sep 17 00:00:00 2001 From: Justin McCandless Date: Fri, 31 Jul 2020 10:43:10 -0700 Subject: [PATCH 2/3] Test that keyboardType is the default value --- .../darwin/ios/framework/Source/FlutterTextInputPluginTest.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m index 7f69a19664de1..69a0ed2492464 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m @@ -145,6 +145,9 @@ - (void)testSecureInput { // Verify secureTextEntry is set to the correct value. XCTAssertTrue(inputView.secureTextEntry); + // Verify keyboardType is set to the default value. + XCTAssertEqual(inputView.keyboardType, UIKeyboardTypeDefault); + // We should have only ever created one FlutterTextInputView. XCTAssertEqual(inputFields.count, 1); From b526eb72edaa102ae1005eb69465ecd373d12758 Mon Sep 17 00:00:00 2001 From: Justin McCandless Date: Fri, 31 Jul 2020 10:57:20 -0700 Subject: [PATCH 3/3] Test that custom keyboard type values are set properly --- .../framework/Source/FlutterTextInputPluginTest.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m index 69a0ed2492464..cb64ba1d44765 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m @@ -451,6 +451,20 @@ - (void)testPasswordAutofillHack { XCTAssertNotEqual([inputView performSelector:@selector(font)], nil); } +- (void)testKeyboardType { + NSDictionary* config = self.mutableTemplateCopy; + [config setValue:@{@"name" : @"TextInputType.url"} forKey:@"inputType"]; + [self setClientId:123 configuration:config]; + + // Find all the FlutterTextInputViews we created. + NSArray* inputFields = self.installedInputViews; + + FlutterTextInputView* inputView = inputFields[0]; + + // Verify keyboardType is set to the value specified in config. + XCTAssertEqual(inputView.keyboardType, UIKeyboardTypeURL); +} + - (void)testAutocorrectionPromptRectAppears { FlutterTextInputView* inputView = [[FlutterTextInputView alloc] initWithFrame:CGRectZero]; inputView.textInputDelegate = engine;