feat(inventory): editable vernacular (common) names
The "also known as" names were read-only; now they can be added and removed: - Repository: addVernacularName + removeVernacularName (soft delete); VarietyDetail.vernacularNames carries ids (new VernacularName model). - Cubit: addVernacularName / removeVernacularName. - Detail: deletable name chips + an "Add name" chip opening a small dialog; the section is always visible so names can be added when empty. Tests: repo add/remove + widget add/remove. 44 green.
This commit is contained in:
parent
f8d4d9a778
commit
9e5c82184b
10 changed files with 256 additions and 83 deletions
|
|
@ -255,4 +255,32 @@ void main() {
|
|||
expect(find.text('No lots yet.'), findsOneWidget);
|
||||
await disposeTree(tester);
|
||||
});
|
||||
|
||||
testWidgets('adding and removing a vernacular name', (tester) async {
|
||||
final repo = newTestRepository(db);
|
||||
final id = await repo.addQuickVariety(label: 'Maize');
|
||||
|
||||
await tester.pumpWidget(
|
||||
wrapDetail(
|
||||
repository: repo,
|
||||
varietyId: id,
|
||||
species: newTestSpeciesRepository(db),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.byKey(const Key('name.add')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.enterText(find.byKey(const Key('name.field')), 'Maíz');
|
||||
await tester.tap(find.byKey(const Key('name.save')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Maíz'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byIcon(Icons.close)); // the chip's delete icon
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Maíz'), findsNothing);
|
||||
await disposeTree(tester);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue