test: 增加登录页面键盘弹出布局测试
This commit is contained in:
@@ -60,4 +60,28 @@ void main() {
|
||||
|
||||
expect((topSpace - bottomSpace).abs(), lessThanOrEqualTo(2));
|
||||
});
|
||||
|
||||
testWidgets('Login screen does not overflow when keyboard is visible', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
final mockAuthBloc = MockAuthBloc();
|
||||
when(() => mockAuthBloc.state).thenReturn(AuthInitial());
|
||||
when(
|
||||
() => mockAuthBloc.stream,
|
||||
).thenAnswer((_) => Stream.value(AuthInitial()));
|
||||
|
||||
await tester.pumpWidget(
|
||||
MediaQuery(
|
||||
data: const MediaQueryData(
|
||||
size: Size(390, 844),
|
||||
viewInsets: EdgeInsets.only(bottom: 320),
|
||||
),
|
||||
child: LinksyApp(authBloc: mockAuthBloc),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(find.text('登录'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user