Design: Terminal is the default when none is stored; Default is now Classic
An unset (or unknown) design id resolves to Terminal, in the controller's initial value, AppDesign.fromId and the boot spinner. A stored choice, including Classic's stable 'default' id, is respected. The picker calls the original Material look Classic so no row reads 'Default'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,7 @@ AppDesignTokens _tokens(WidgetTester tester) =>
|
||||
AppDesignTokens.of(tester.element(find.text(designSectionTitle)));
|
||||
|
||||
void main() {
|
||||
testWidgets('every design is a radio row; Default is chosen at first', (
|
||||
testWidgets('every design is a radio row; Terminal is chosen at first', (
|
||||
tester,
|
||||
) async {
|
||||
final designs = AppDesignController(store: MemoryAppDesignStore());
|
||||
@@ -43,40 +43,43 @@ void main() {
|
||||
final group = tester.widget<RadioGroup<AppDesign>>(
|
||||
find.byType(RadioGroup<AppDesign>),
|
||||
);
|
||||
expect(group.groupValue, AppDesign.standard);
|
||||
expect(_tokens(tester).terminal, isFalse);
|
||||
expect(group.groupValue, AppDesign.terminal);
|
||||
expect(_tokens(tester).terminal, isTrue);
|
||||
// The Material look is called Classic, so no row reads "Default".
|
||||
expect(find.text('Classic'), findsOneWidget);
|
||||
expect(find.text('Default'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('choosing Terminal stores it and restyles the page live', (
|
||||
testWidgets('choosing Classic stores it and restyles the page live', (
|
||||
tester,
|
||||
) async {
|
||||
final store = MemoryAppDesignStore();
|
||||
final designs = AppDesignController(store: store);
|
||||
await _pump(tester, designs);
|
||||
|
||||
await tester.tap(find.text(AppDesign.terminal.label));
|
||||
await tester.pumpAndSettle();
|
||||
expect(store.id, AppDesign.terminal.id);
|
||||
expect(designs.design, AppDesign.terminal);
|
||||
expect(_tokens(tester).terminal, isTrue);
|
||||
expect(find.text(designSaveFailedText), findsNothing);
|
||||
|
||||
await tester.tap(find.text(AppDesign.standard.label));
|
||||
await tester.pumpAndSettle();
|
||||
expect(store.id, AppDesign.standard.id);
|
||||
expect(designs.design, AppDesign.standard);
|
||||
expect(_tokens(tester).terminal, isFalse);
|
||||
expect(find.text(designSaveFailedText), findsNothing);
|
||||
|
||||
await tester.tap(find.text(AppDesign.terminal.label));
|
||||
await tester.pumpAndSettle();
|
||||
expect(store.id, AppDesign.terminal.id);
|
||||
expect(_tokens(tester).terminal, isTrue);
|
||||
});
|
||||
|
||||
testWidgets('a stored choice is restored into the picker', (tester) async {
|
||||
final designs = AppDesignController(
|
||||
store: MemoryAppDesignStore(AppDesign.terminal.id),
|
||||
store: MemoryAppDesignStore(AppDesign.standard.id),
|
||||
);
|
||||
await designs.restore();
|
||||
await _pump(tester, designs);
|
||||
final group = tester.widget<RadioGroup<AppDesign>>(
|
||||
find.byType(RadioGroup<AppDesign>),
|
||||
);
|
||||
expect(group.groupValue, AppDesign.terminal);
|
||||
expect(group.groupValue, AppDesign.standard);
|
||||
});
|
||||
|
||||
testWidgets('a failed save says the choice lasts until reload', (
|
||||
@@ -86,10 +89,10 @@ void main() {
|
||||
store: MemoryAppDesignStore()..failSaves = true,
|
||||
);
|
||||
await _pump(tester, designs);
|
||||
await tester.tap(find.text(AppDesign.terminal.label));
|
||||
await tester.tap(find.text(AppDesign.paper.label));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(designSaveFailedText), findsOneWidget);
|
||||
expect(designs.design, AppDesign.terminal);
|
||||
expect(designs.design, AppDesign.paper);
|
||||
});
|
||||
|
||||
testWidgets('choosing Paper stores it, restyles the page live and is '
|
||||
|
||||
Reference in New Issue
Block a user