Skip to content

Tests on macOS cannot simulate the enter key triggering the onEditingComplete method of a TextField. #156414

@yiiim

Description

@yiiim

Use case

When creating tests for #156412, I was unable to simulate the enter key triggering onEditingComplete for the TextField. When I used simulateKeyDownEvent(LogicalKeyboardKey.enter), it always sent the insertNewline message due to the code at

const SingleActivator(LogicalKeyboardKey.enter): <String>['insertNewline:'],
.

tester.binding.testTextInput.receiveAction(TextInputAction.done) also does not satisfy this case, because I am not always sure that the focus is on the TextField.

Proposal

Provide a way to simulate the enter key triggering the onEditingComplete method of a TextField.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: tests"flutter test", flutter_test, or one of our testsa: text inputEntering text in a text field or keyboard related problemsc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions