test(apps): 更新测试文件适配路由重构
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:social_app/features/settings/ui/widgets/account_section_card.dart';
|
import 'package:social_app/features/settings/ui/widgets/account_section_card.dart';
|
||||||
import 'package:social_app/features/settings/ui/widgets/account_surface_scaffold.dart';
|
import 'package:social_app/features/settings/ui/widgets/settings_page_scaffold.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('AccountSectionCard renders title and description', (
|
testWidgets('AccountSectionCard renders title and description', (
|
||||||
@@ -24,14 +24,11 @@ void main() {
|
|||||||
expect(find.text('内容区'), findsOneWidget);
|
expect(find.text('内容区'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('AccountSurfaceScaffold renders header and footer', (
|
testWidgets('SettingsPageScaffold renders header and footer', (tester) async {
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: AccountSurfaceScaffold(
|
home: SettingsPageScaffold(
|
||||||
title: '编辑资料',
|
title: '编辑资料',
|
||||||
subtitle: '管理账户公开信息',
|
|
||||||
body: const Text('主体内容'),
|
body: const Text('主体内容'),
|
||||||
footer: const Text('底部操作区'),
|
footer: const Text('底部操作区'),
|
||||||
onBack: () {},
|
onBack: () {},
|
||||||
@@ -40,20 +37,17 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(find.text('编辑资料'), findsOneWidget);
|
expect(find.text('编辑资料'), findsOneWidget);
|
||||||
expect(find.text('管理账户公开信息'), findsOneWidget);
|
|
||||||
expect(find.text('主体内容'), findsOneWidget);
|
expect(find.text('主体内容'), findsOneWidget);
|
||||||
expect(find.text('底部操作区'), findsOneWidget);
|
expect(find.text('底部操作区'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('AccountSurfaceScaffold renders compact header title', (
|
testWidgets('SettingsPageScaffold renders body without footer', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: AccountSurfaceScaffold(
|
home: SettingsPageScaffold(
|
||||||
title: '账户',
|
title: '账户',
|
||||||
subtitle: '不会在紧凑模式显示',
|
|
||||||
compactHeaderTitle: true,
|
|
||||||
body: const Text('主体内容'),
|
body: const Text('主体内容'),
|
||||||
onBack: () {},
|
onBack: () {},
|
||||||
),
|
),
|
||||||
@@ -61,7 +55,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(find.text('账户'), findsOneWidget);
|
expect(find.text('账户'), findsOneWidget);
|
||||||
expect(find.text('不会在紧凑模式显示'), findsNothing);
|
|
||||||
expect(find.text('主体内容'), findsOneWidget);
|
expect(find.text('主体内容'), findsOneWidget);
|
||||||
|
expect(find.text('底部操作区'), findsNothing);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user