feat(home): 首页按内容类型分频道 Feed 并支持分页
This commit is contained in:
1 parent
4d0be47ee3
commit
ae61d9ec4c
22 files changed
+1001
-71
No files matched your search
@@ -0,0 +1,54 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/core/theme/app_theme.dart';
|
||||
import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||
import 'package:fruitshorts/pages/home/home_feed_channel.dart';
|
||||
import 'package:fruitshorts/pages/player/widgets/home_feed_header.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('should_emit_channel_callbacks_and_render_selected_channel', (
|
||||
tester,
|
||||
) async {
|
||||
final selected = <HomeFeedChannel>[];
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: AppTheme.light(),
|
||||
locale: const Locale('en'),
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
home: Builder(
|
||||
builder: (context) => Scaffold(
|
||||
body: HomeFeedHeader(
|
||||
l10n: AppLocalizations.of(context)!,
|
||||
channel: HomeFeedChannel.anime,
|
||||
onChannelSelected: selected.add,
|
||||
onRefresh: () async => true,
|
||||
onSearch: () {},
|
||||
onMore: () {},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byKey(const Key('home-feed-tab-anime')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-tab-real')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-tab-recommend')), findsOneWidget);
|
||||
expect(
|
||||
tester.widget<Text>(find.text('Anime')).style?.fontWeight,
|
||||
FontWeight.w800,
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-feed-tab-real')));
|
||||
await tester.tap(find.byKey(const Key('home-feed-tab-recommend')));
|
||||
await tester.tap(find.byKey(const Key('home-feed-tab-anime')));
|
||||
|
||||
expect(selected, [
|
||||
HomeFeedChannel.live,
|
||||
HomeFeedChannel.recommend,
|
||||
HomeFeedChannel.anime,
|
||||
]);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user