feat(studyset): an empty tab says its material is in the topics, and leads there

People testing the app looked for the material of a studyset that groups
topics in its own empty tabs, which said "No flashcards yet" and how to
add some. A tab with none of its own while the topics hold some now says
so: "The flashcards are in its topics", each topic holding some with how
much (everything inside it counted), opening it; for flashcards Browse
all of them in one list; and, quieter, how to add some here after all.
Opened for the first time, such a studyset shows the first tab its topics
fill. The tabs' counts stay the studyset's own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-14 13:37:55 +02:00
commit 31e4d7d64b
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -176,6 +176,80 @@ void main() {
);
}
group('A studyset whose topics hold its material', () {
testWidgets("says where an empty tab's material is, each topic with how "
'much it holds, opening it; Browse lists them all', (tester) async {
stored('japanese', 'Japanese');
stored('kana', 'Kana', parent: 'japanese');
stored('grammar', 'Grammar', parent: 'japanese', position: 'a1');
stored('particles', 'Particles', parent: 'grammar');
await card('kana', 'あ');
await card('kana', 'い');
await card('particles', 'は');
await showApp(
tester,
location: RoutePaths.studyset('japanese'),
width: 400,
);
await tester.pumpAndSettle();
expect(find.text('The flashcards are in its topics'), findsOneWidget);
expect(find.text('No flashcards yet'), findsNothing);
final kana = find.ancestor(
of: find.text('Kana').last,
matching: find.byType(ListTile),
);
expect(
find.descendant(of: kana, matching: find.text('2')),
findsOneWidget,
);
// Everything inside a topic counts: Grammar holds Particles' card.
final grammar = find.ancestor(
of: find.text('Grammar').last,
matching: find.byType(ListTile),
);
expect(
find.descendant(of: grammar, matching: find.text('1')),
findsOneWidget,
);
expect(find.text('Browse all 3'), findsOneWidget);
// The tab counts its own alone.
expect(
find.descendant(of: find.byType(Tab), matching: find.text('3')),
findsNothing,
);
await tester.tap(kana);
await tester.pumpAndSettle();
expect(
find.descendant(
of: find.byType(StudysetBreadcrumb),
matching: find.text('Kana'),
),
findsWidgets,
);
});
testWidgets('an empty tab whose topics hold none of it says so as ever', (
tester,
) async {
stored('japanese', 'Japanese');
stored('kana', 'Kana', parent: 'japanese');
await card('kana', 'あ');
await showApp(
tester,
location: RoutePaths.studyset('japanese'),
width: 400,
);
await tester.pumpAndSettle();
await tester.tap(find.text('Notes'));
await tester.pumpAndSettle();
expect(find.text('No notes yet'), findsOneWidget);
expect(find.text('The notes are in its topics'), findsNothing);
});
});
testWidgets('beside the rail on a narrow desktop window, Add material is '
'an icon, so the app bar fits', (tester) async {
stored('japanese', 'Japanese');
@ -359,7 +433,13 @@ void main() {
await card('kana', 'あ');
await openFromLibrary(tester, 'Japanese');
await tester.longPress(find.text('Kana'));
// The topic in the rail; the empty tabs list it too.
await tester.longPress(
find.descendant(
of: find.byType(StudysetRail),
matching: find.text('Kana'),
),
);
await tester.pumpAndSettle();
await tester.tap(find.text('Reset progress'));
await tester.pump();