Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test
  • Loading branch information
LinXunFeng committed Apr 9, 2023
commit ca8094b2eb2b5ddf11b880de61c807bccde2adf7
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ - (FlutterTextRange*)getLineRangeFromTokenizer:(id<UITextInputTokenizer>)tokeniz
return (FlutterTextRange*)range;
}

- (void)updateConfig:(NSDictionary*)config {
FlutterMethodCall* updateConfigCall =
[FlutterMethodCall methodCallWithMethodName:@"TextInput.updateConfig" arguments:config];
[textInputPlugin handleMethodCall:updateConfigCall
result:^(id _Nullable result){
}];
}

#pragma mark - Tests

- (void)testWillNotCrashWhenViewControllerIsNil {
Expand Down Expand Up @@ -647,6 +655,23 @@ - (void)testPropagatePressEventsToViewController2 {
withEvent:[OCMArg isNotNil]]);
}

- (void)testUpdateSecureTextEntry {
NSDictionary* config = self.mutableTemplateCopy;
[config setValue:@"YES" forKey:@"obscureText"];
[self setClientId:123 configuration:config];

NSArray<FlutterTextInputView*>* inputFields = self.installedInputViews;
FlutterTextInputView* inputView = inputFields[0];

XCTAssertTrue(inputView.isSecureTextEntry);

config = self.mutableTemplateCopy;
[config setValue:@"NO" forKey:@"obscureText"];
[self updateConfig:config];

XCTAssertFalse(inputView.isSecureTextEntry);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also test if [inputView reloadInputViews]; is called?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

#pragma mark - TextEditingDelta tests
- (void)testTextEditingDeltasAreGeneratedOnTextInput {
FlutterTextInputView* inputView = [[FlutterTextInputView alloc] initWithOwner:textInputPlugin];
Expand Down