Design system - MilerSurface ladder (canvas → working → raised → floating) with MilerPanel as layer 1; canvas moved to #DEE3EA so white separates at 1.290:1. - Visible vocabulary applied across Home, Deliveries, Activity, Account and the sheets: hero heads (tabular numeral + small caption, clamped at 1.3x), canvas wells for anything that opens, small filled tags for shelf labels, demoted placeholders. Recorded in DESIGN_SYSTEM.md §6. - One icon family: 222 Material glyphs migrated to Lucide; none left outside lib/xpress. - Colour semantics corrected: amber only for what is genuinely owed, brand red reserved for the live stop, disabled primaries go neutral rather than pale. Data and lifecycle - lib/data/lifecycle.dart reads mutations for what they prove; route_order.dart makes admin sequence the single ordering authority; service_day.dart, and stop_area.dart rewritten against live Coimbatore addresses (digit-token stripping, city stoplist, street suffixes, stammer collapse). - countLabel states the load once, in bags. Testing - 1440 tests passing; golden shot harnesses for Home, Deliveries, Activity, sheets and verify, with test/failures/ now gitignored (diff debris). - New pins: home_gutter_test, stop_area_test, plus updated structural bounds. Note: this commit also carries pre-existing working-tree deletions that were present before this work (API_SPEC.md, README.md, demo test fixtures). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
70 lines
2.4 KiB
Dart
70 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:miler/views/Dashboard/home/accepted_pill.dart';
|
|
import 'package:miler/views/helpers/constants/design_constants.dart';
|
|
|
|
/// The way from Home to the work used to be a "Continue trip" button under the
|
|
/// last hub row of a trip — so it only existed once that trip had nothing left
|
|
/// to decide, and it was below the fold on any route longer than about four
|
|
/// stops. The pill replaces it: same fixed place every time, and it says how
|
|
/// many bookings the rider is holding.
|
|
void main() {
|
|
Future<void> pump(
|
|
WidgetTester tester,
|
|
int count, {
|
|
VoidCallback? onTap,
|
|
}) async {
|
|
tester.view.physicalSize = const Size(1170, 2532);
|
|
tester.view.devicePixelRatio = 3.0;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
|
|
await tester.pumpWidget(
|
|
ScreenUtilInit(
|
|
designSize: const Size(390, 844),
|
|
builder: (_, _) => MaterialApp(
|
|
home: Scaffold(
|
|
body: AcceptedPill(count: count, onTap: onTap ?? () {}),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
}
|
|
|
|
testWidgets('says nothing when nothing is accepted', (tester) async {
|
|
await pump(tester, 0);
|
|
expect(find.textContaining('accepted'), findsNothing);
|
|
});
|
|
|
|
testWidgets('carries the count and the singular wording', (tester) async {
|
|
await pump(tester, 1);
|
|
expect(find.text('1'), findsOneWidget);
|
|
expect(find.text('booking accepted'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('pluralises', (tester) async {
|
|
await pump(tester, 4);
|
|
expect(find.text('4'), findsOneWidget);
|
|
expect(find.text('bookings accepted'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('is a tap target that leads somewhere', (tester) async {
|
|
var taps = 0;
|
|
await pump(tester, 3, onTap: () => taps++);
|
|
|
|
await tester.tap(find.text('bookings accepted'));
|
|
await tester.pumpAndSettle();
|
|
expect(taps, 1);
|
|
|
|
// Material's touch-target floor. The pill is small on purpose — it is a way
|
|
// through, not the action Home exists for — so this is the guard that keeps
|
|
// "small" from becoming "hard to hit at arm's length".
|
|
final height = tester.getSize(find.byType(InkWell)).height;
|
|
expect(height, greaterThanOrEqualTo(48.0));
|
|
expect(ButtonSizes.minTapTarget, lessThanOrEqualTo(height));
|
|
});
|
|
}
|