feat(ui): 重做三 Tab 首页与发现页
This commit is contained in:
1 parent
eae1c533ce
commit
e8c1859e70
23 files changed
+1734
-432
No files matched your search
@@ -18,17 +18,20 @@ void main() {
|
||||
|
||||
final dramas = [_drama('signal'), _drama('city')];
|
||||
|
||||
test('should_make_first_catalog_entry_the_current_drama_when_catalog_loads', () {
|
||||
final logic = HomeLogic(dramas);
|
||||
test(
|
||||
'should_make_first_catalog_entry_the_current_drama_when_catalog_loads',
|
||||
() {
|
||||
final logic = HomeLogic(dramas);
|
||||
|
||||
expect(logic.currentDrama.id, 'signal');
|
||||
expect(logic.tab, 1);
|
||||
expect(logic.mySection, 0);
|
||||
expect(logic.drawerOpen, isFalse);
|
||||
expect(logic.profile, isFalse);
|
||||
expect(logic.videoImmersive, isFalse);
|
||||
logic.dispose();
|
||||
});
|
||||
expect(logic.currentDrama.id, 'signal');
|
||||
expect(logic.tab, 0);
|
||||
expect(logic.mySection, 0);
|
||||
expect(logic.drawerOpen, isFalse);
|
||||
expect(logic.profile, isFalse);
|
||||
expect(logic.videoImmersive, isFalse);
|
||||
logic.dispose();
|
||||
},
|
||||
);
|
||||
|
||||
test('should_not_build_shell_when_catalog_is_empty', () {
|
||||
expect(() => HomeLogic(const []), throwsStateError);
|
||||
@@ -82,33 +85,38 @@ void main() {
|
||||
logic.dispose();
|
||||
});
|
||||
|
||||
test('should_differ_on_profile_flag_when_open_profile_and_open_library_are_used', () {
|
||||
final logic = HomeLogic(dramas);
|
||||
test(
|
||||
'should_differ_on_profile_flag_when_open_profile_and_open_library_are_used',
|
||||
() {
|
||||
final logic = HomeLogic(dramas);
|
||||
|
||||
logic.openProfile();
|
||||
expect(logic.profile, isTrue);
|
||||
expect(logic.tab, 2);
|
||||
expect(logic.mySection, 0);
|
||||
expect(logic.sectionRequest, 1);
|
||||
logic.openProfile();
|
||||
expect(logic.profile, isTrue);
|
||||
expect(logic.tab, 2);
|
||||
expect(logic.mySection, 0);
|
||||
expect(logic.sectionRequest, 1);
|
||||
|
||||
logic.openLibrary(section: 1);
|
||||
expect(logic.profile, isFalse);
|
||||
expect(logic.mySection, 1);
|
||||
expect(logic.sectionRequest, 2);
|
||||
logic.openLibrary(section: 1);
|
||||
expect(logic.profile, isFalse);
|
||||
expect(logic.mySection, 1);
|
||||
expect(logic.sectionRequest, 2);
|
||||
|
||||
logic.openLibrary();
|
||||
expect(logic.profile, isFalse);
|
||||
expect(logic.mySection, 1);
|
||||
expect(logic.sectionRequest, 3);
|
||||
logic.dispose();
|
||||
});
|
||||
logic.openLibrary();
|
||||
expect(logic.profile, isFalse);
|
||||
expect(logic.mySection, 1);
|
||||
expect(logic.sectionRequest, 3);
|
||||
logic.dispose();
|
||||
},
|
||||
);
|
||||
|
||||
test('should_return_home_and_open_drawer_when_system_back_is_pressed', () {
|
||||
final logic = HomeLogic(dramas);
|
||||
|
||||
// Home is the launch tab; the first back press lands on Discover.
|
||||
logic.onSystemBack();
|
||||
expect(logic.tab, 1);
|
||||
logic.onSystemBack();
|
||||
expect(logic.drawerOpen, isTrue);
|
||||
expect(logic.tab, 1);
|
||||
expect(logic.backRequest, 0);
|
||||
logic.onDrawerChanged(false);
|
||||
|
||||
@@ -190,7 +198,9 @@ void main() {
|
||||
expect(notifications, 0);
|
||||
});
|
||||
|
||||
testWidgets('should_map_onto_root_tabs_when_discover_actions_fire', (tester) async {
|
||||
testWidgets('should_map_onto_root_tabs_when_discover_actions_fire', (
|
||||
tester,
|
||||
) async {
|
||||
final logic = HomeLogic(dramas);
|
||||
late BuildContext context;
|
||||
await tester.pumpWidget(
|
||||
|
||||
Reference in new issue
Block a user