mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-14 20:30:58 +01:00
The pre-push coverage gate only ran for whoever had the local hook installed, which is deployment hygiene rather than a gate. Adds the mirrored workflow sync_settings_ui already has, so the 100% bar is enforced on push and PR. EmptyState.action was invented surface: no donor had it. home_inventory's three call sites are pure placeholders, and kuhylog's action-bearing _empty was explicitly excluded from the survey as a different element. Shipping a parameter nobody asked for on a widget that has no consumer yet is the failure mode this package is supposed to avoid, so it goes, with a comment recording why rather than leaving the next reader to rediscover it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XS1m7b1piBtAL22USLW6jL
65 lines
2.2 KiB
Dart
65 lines
2.2 KiB
Dart
import 'package:design_system/design_system.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
Future<void> _pumpEmptyState(WidgetTester tester) {
|
|
return tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: buildDarkTheme(),
|
|
home: const Scaffold(
|
|
body: EmptyState(
|
|
icon: Icons.inbox_outlined,
|
|
title: 'Nothing here yet',
|
|
message: 'Add your first item to get started.',
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void main() {
|
|
testWidgets('shows the icon, title and message', (tester) async {
|
|
await _pumpEmptyState(tester);
|
|
expect(find.byIcon(Icons.inbox_outlined), findsOneWidget);
|
|
expect(find.text('Nothing here yet'), findsOneWidget);
|
|
expect(find.text('Add your first item to get started.'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('draws the icon at the shared size in the muted color', (
|
|
tester,
|
|
) async {
|
|
await _pumpEmptyState(tester);
|
|
final icon = tester.widget<Icon>(find.byType(Icon));
|
|
expect(icon.size, AppSpacing.xxl);
|
|
expect(icon.color, buildDarkTheme().colorScheme.onSurfaceVariant);
|
|
});
|
|
|
|
testWidgets('mutes the message but not the title', (tester) async {
|
|
await _pumpEmptyState(tester);
|
|
final scheme = buildDarkTheme().colorScheme;
|
|
|
|
final message = tester.widget<Text>(
|
|
find.text('Add your first item to get started.'),
|
|
);
|
|
expect(message.style?.color, scheme.onSurfaceVariant);
|
|
expect(message.textAlign, TextAlign.center);
|
|
|
|
final title = tester.widget<Text>(find.text('Nothing here yet'));
|
|
expect(title.style?.color, isNot(scheme.onSurfaceVariant));
|
|
});
|
|
|
|
testWidgets('is a pure placeholder with no action', (tester) async {
|
|
// Deliberate: no donor had an action slot, so adding one would be
|
|
// speculative surface on a widget that has no consumer yet.
|
|
await _pumpEmptyState(tester);
|
|
expect(find.byType(ButtonStyleButton), findsNothing);
|
|
});
|
|
|
|
testWidgets('stays centred and shrink-wrapped', (tester) async {
|
|
await _pumpEmptyState(tester);
|
|
expect(find.byType(Center), findsWidgets);
|
|
final column = tester.widget<Column>(find.byType(Column));
|
|
expect(column.mainAxisSize, MainAxisSize.min);
|
|
});
|
|
}
|