feat(flutter): 首页改为沉浸式 feed 流
This commit is contained in:
1 parent
698fb12e07
commit
b7926d64a5
5 files changed
+55
-240
No files matched your search
@@ -23,9 +23,7 @@ import '../support/fake_notice_repository.dart';
|
||||
import '../support/widget_player.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('should_render_browse_home_with_header_channels_and_cards', (
|
||||
tester,
|
||||
) async {
|
||||
testWidgets('should_render_immersive_feed_on_home', (tester) async {
|
||||
SharedPreferencesAsyncPlatform.instance =
|
||||
InMemorySharedPreferencesAsync.empty();
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
@@ -61,50 +59,13 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('tab-home')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('home-search')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-profile')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-notifications')), findsOneWidget);
|
||||
for (final channel in ['hot', 'free', 'newReleases', 'ranking']) {
|
||||
expect(find.byKey(Key('home-channel-$channel')), findsOneWidget);
|
||||
}
|
||||
expect(find.byKey(const Key('home-hero-banner')), findsOneWidget);
|
||||
expect(
|
||||
find.byKey(const Key('home-drama-card-the-signal-demo')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byKey(const Key('home-feed-info-card')), findsNothing);
|
||||
expect(find.byKey(const Key('home-feed-title')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-info-card')), findsOneWidget);
|
||||
expect(find.byType(PageView), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-browse-page')), findsNothing);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('should_open_notices_when_bell_is_tapped', (tester) async {
|
||||
SharedPreferencesAsyncPlatform.instance =
|
||||
InMemorySharedPreferencesAsync.empty();
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final catalog = FakeCatalogRepository();
|
||||
await tester.pumpWidget(
|
||||
LumaDramaApp(
|
||||
playerFactory: createWidgetPlayer,
|
||||
catalogRepository: catalog,
|
||||
categoryRepository: FakeCategoryRepository(catalog: catalog),
|
||||
watchHistoryRepository: InMemoryWatchHistoryRepository(),
|
||||
favoriteRepository: InMemoryFavoriteRepository(cards: catalog.dramas),
|
||||
playbackRepository: FakePlaybackRepository(),
|
||||
commentRepository: FakeCommentRepository(),
|
||||
interactionRepository: FakeInteractionRepository(),
|
||||
noticeRepository: FakeNoticeRepository(),
|
||||
haptics: FakeHaptics(),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-notifications')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('notices-page')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_use_episode_title_then_drama_title_as_fallback', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in new issue
Block a user