test(tv): follow the native text input contract on Apple TV
71735354made TvTextInputPresentation.automatic use native platform input for single-line Apple TV fields, and829d3745migrated the search and Add Jellyfin suites to it. These five cases still expected the Flutter on-screen keyboard widget and failed looking for a panel that no longer exists. Drives the native path instead: each case asserts input is live (readOnly false), raises the keyboard, then keeps its original regression intent — the first Back deactivates input and is consumed so it cannot also pop, and only the second Back pops or cancels.
This commit is contained in:
@@ -88,18 +88,23 @@ void main() {
|
||||
final result = showTextInputDialog(hostContext, title: 'Name', labelText: 'Name', initialValue: 'TV value');
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
final field = tester.widget<TextField>(find.byType(TextField, skipOffstage: false));
|
||||
expect(find.byKey(const Key('tv_virtual_keyboard_dialog')), findsOneWidget);
|
||||
final fieldFinder = find.byType(TextField, skipOffstage: false);
|
||||
final field = tester.widget<TextField>(fieldFinder);
|
||||
expect(find.byKey(const Key('tv_virtual_keyboard_dialog')), findsNothing);
|
||||
expect(field.readOnly, isFalse);
|
||||
await tester.showKeyboard(fieldFinder);
|
||||
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.escape);
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('tv_virtual_keyboard_dialog')), findsOneWidget);
|
||||
expect(find.byType(AlertDialog), findsOneWidget);
|
||||
expect(tester.widget<TextField>(fieldFinder).readOnly, isTrue);
|
||||
|
||||
await tester.sendKeyUpEvent(LogicalKeyboardKey.escape);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('tv_virtual_keyboard_dialog')), findsNothing);
|
||||
expect(find.byType(AlertDialog), findsOneWidget);
|
||||
expect(field.focusNode?.hasPrimaryFocus, isTrue);
|
||||
expect(tester.widget<TextField>(fieldFinder).readOnly, isTrue);
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
Reference in New Issue
Block a user