fix(recommend): 修正推荐子页内容映射

This commit is contained in:
Zhou Weidong committed 2026-10-22 17:36:58 +08:00
1 parent af6b9bb3db
commit d06967c6ab
8 files changed
+128 -48

No files matched your search

+28 -2
View File
@@ -23,7 +23,7 @@ void main() {
InMemorySharedPreferencesAsync.empty();
});
testWidgets('should_render_three_recommend_sections_and_horizontal_cards', (
testWidgets('should_render_immersive_player_as_recommend_tab', (
tester,
) async {
await _pumpRecommend(tester);
@@ -32,6 +32,25 @@ void main() {
expect(find.byKey(const Key('recommend-tab-recommend')), findsOneWidget);
expect(find.byKey(const Key('recommend-tab-playlist')), findsOneWidget);
expect(find.byKey(const Key('recommend-tab-all')), findsOneWidget);
expect(find.byKey(const Key('recommend-feed-player')), findsOneWidget);
final player = tester.widget<PlayerPage>(
find.byKey(const Key('recommend-feed-player')),
);
expect(player.homeMode, isTrue);
expect(player.embedded, isTrue);
expect(player.showHomeFeedHeader, isFalse);
expect(find.byType(PageView), findsOneWidget);
expect(find.byKey(const Key('recommend-section-hits')), findsNothing);
expect(find.byType(AppBottomNav), findsOneWidget);
});
testWidgets('should_render_playlist_sections_and_horizontal_cards', (
tester,
) async {
await _pumpRecommend(tester);
await tester.tap(find.byKey(const Key('recommend-tab-playlist')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('recommend-section-hits')), findsOneWidget);
expect(find.byKey(const Key('recommend-section-new')), findsOneWidget);
expect(find.byKey(const Key('recommend-section-costume')), findsOneWidget);
@@ -54,6 +73,10 @@ void main() {
) async {
await _pumpRecommend(tester);
await tester.tap(find.byKey(const Key('recommend-tab-playlist')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('recommend-section-hits')), findsOneWidget);
await tester.tap(find.byKey(const Key('recommend-tab-all')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('all-dramas-grid')), findsOneWidget);
@@ -68,7 +91,8 @@ void main() {
await tester.tap(find.byKey(const Key('recommend-tab-playlist')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('ranking-page')), findsOneWidget);
expect(find.byKey(const Key('recommend-section-hits')), findsOneWidget);
expect(find.byKey(const Key('recommend-feed-player')), findsNothing);
expect(find.byType(AppBottomNav), findsOneWidget);
await tester.tap(find.byKey(const Key('recommend-tab-all')));
@@ -82,6 +106,8 @@ void main() {
) async {
await _pumpRecommend(tester);
await tester.tap(find.byKey(const Key('recommend-tab-playlist')));
await tester.pumpAndSettle();
await tester.tap(
find.byKey(const Key('recommend-card-hits-the-signal-demo')),
);