Merge branch 'worktree-print-labels': print seed labels with QR
# Conflicts: # apps/app_seeds/lib/i18n/strings.g.dart # apps/app_seeds/lib/ui/inventory_list_screen.dart
This commit is contained in:
commit
63f48db5c2
21 changed files with 1522 additions and 115 deletions
|
|
@ -147,4 +147,50 @@ void main() {
|
|||
expect(state.categories, hasLength(2));
|
||||
expect(state.categories.toSet(), {'Poaceae', 'Fabaceae'});
|
||||
});
|
||||
|
||||
group('selection mode', () {
|
||||
test('enterSelection starts the mode with one id', () async {
|
||||
await repo.addQuickVariety(label: 'Bean');
|
||||
final state = await waitFor(cubit, (s) => s.items.isNotEmpty);
|
||||
final id = state.items.single.id;
|
||||
|
||||
cubit.enterSelection(id);
|
||||
expect(cubit.state.selectionMode, isTrue);
|
||||
expect(cubit.state.selectedIds, {id});
|
||||
});
|
||||
|
||||
test('toggleSelection adds then removes, staying in mode', () async {
|
||||
await repo.addQuickVariety(label: 'Bean');
|
||||
final state = await waitFor(cubit, (s) => s.items.isNotEmpty);
|
||||
final id = state.items.single.id;
|
||||
|
||||
cubit.toggleSelection(id);
|
||||
expect(cubit.state.selectedIds, {id});
|
||||
|
||||
cubit.toggleSelection(id);
|
||||
expect(cubit.state.selectedIds, isEmpty);
|
||||
expect(cubit.state.selectionMode, isTrue);
|
||||
});
|
||||
|
||||
test('selectAllVisible selects only the filtered subset', () async {
|
||||
await repo.addQuickVariety(label: 'Bean', category: 'Fabaceae');
|
||||
await repo.addQuickVariety(label: 'Tomato', category: 'Solanaceae');
|
||||
final state = await waitFor(cubit, (s) => s.items.length == 2);
|
||||
final beanId = state.items.firstWhere((i) => i.label == 'Bean').id;
|
||||
|
||||
cubit.toggleCategory('Fabaceae'); // hide the tomato
|
||||
cubit.selectAllVisible();
|
||||
expect(cubit.state.selectedIds, {beanId});
|
||||
});
|
||||
|
||||
test('exitSelection leaves the mode and clears the selection', () async {
|
||||
await repo.addQuickVariety(label: 'Bean');
|
||||
final state = await waitFor(cubit, (s) => s.items.isNotEmpty);
|
||||
cubit.enterSelection(state.items.single.id);
|
||||
|
||||
cubit.exitSelection();
|
||||
expect(cubit.state.selectionMode, isFalse);
|
||||
expect(cubit.state.selectedIds, isEmpty);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue