todo-app/test/notes_list_one_list_test.dart
Krzysztof kuhy Rudnicki 3a747c2e51
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
file-length / file length <= 250 lines (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
Report errors and slow waits to the board
crdt_sync_flutter 0.9.0's installAppErrors in main(): uncaught errors and
every spinner shown over 1 s (WaitWatch: sync.run, mirror.test) upload to
RTDB /todo/errors/<device> with the versionCode, where the PC app-errors
ingest files board tickets (kuhyx/utils DOCS-app-errors.md).

The app moves to material_ui first: sync_settings_ui 0.8.x and
design_system 0.4.x sit on it, and Flutter 3.50 deprecates
flutter/material. Pins: crdt_sync 0.14.1, csf 0.9.0, ssui 0.8.3,
gda 0.5.1, design_system 0.4.1, image 4.13.1, mcp_dart 2.4.4.
file_picker stays 13.3.3, held by data_transfer_flutter 0.2.2
(allowlisted, self-clearing).

appRoute takes a route name so each report names its screen; the
release build passes APP_BUILD/APP_VERSION. Nothing new on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 23:07:58 +01:00

91 lines
3.3 KiB
Dart

// One list: ideas and repo notes together, one row each, repo searchable, and a filter
// sheet that fits a Pixel 6a screen without scrolling.
import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:todo/data/note.dart';
import 'notes_list_harness.dart';
Note _repoNote(
String id,
String title,
String repo, {
Status status = Status.todo,
}) => note(id, title, status: status).copyWith(repo: repo, by: 'claude');
final _seed = [
note('i', 'An idea about tea'),
_repoNote('r1', 'Fix the scanner', 'kuhyx/kartka'),
_repoNote('r2', 'Add barcode cache', 'kuhyx/kartka'),
_repoNote('r3', 'Closed chore', 'kuhyx/kartka', status: Status.done),
];
void _pixel6a(WidgetTester tester) {
tester.view
..physicalSize = const Size(1080, 2400)
..devicePixelRatio = 2.625
..padding = const FakeViewPadding(top: 132, bottom: 63)
..viewPadding = const FakeViewPadding(top: 132, bottom: 63);
addTearDown(tester.view.reset);
}
void main() {
testWidgets('every open note is its own row; no group rows', (tester) async {
_pixel6a(tester);
await pumpList(tester, seed: _seed, applyFilter: true);
expect(find.text('An idea about tea'), findsOneWidget);
expect(find.text('Fix the scanner'), findsOneWidget);
expect(find.text('Add barcode cache'), findsOneWidget);
// The done one is filtered out; nothing says "kartka · 2".
expect(find.text('Closed chore'), findsNothing);
expect(find.textContaining(' · 2'), findsNothing);
// The repo name shows as a small label on each repo note's card.
expect(find.text('kartka'), findsNWidgets(2));
});
testWidgets('searching a repo name finds its notes only', (tester) async {
_pixel6a(tester);
await pumpList(tester, seed: _seed, applyFilter: true);
await tester.enterText(find.byType(TextField), 'kartka');
await tester.pump(const Duration(milliseconds: 300));
await tester.pump();
expect(find.text('Fix the scanner'), findsOneWidget);
expect(find.text('Add barcode cache'), findsOneWidget);
expect(find.text('An idea about tea'), findsNothing);
});
testWidgets('wide windows list one row per note', (tester) async {
await pumpList(tester, seed: _seed, applyFilter: true);
expect(find.text('Fix the scanner'), findsOneWidget);
expect(find.text('Add barcode cache'), findsOneWidget);
expect(find.byType(ListTile), findsNWidgets(3));
});
testWidgets('a filter sheet fits a Pixel 6a screen with no scrolling', (
tester,
) async {
_pixel6a(tester);
await pumpList(tester, seed: _seed, applyFilter: true);
await tester.tap(find.byIcon(Icons.filter_list));
await tester.pump();
await tester.pump(const Duration(milliseconds: 300));
final inSheet = find.descendant(
of: find.byType(BottomSheet),
matching: find.byType(Scrollable),
);
final states = tester.stateList<ScrollableState>(inSheet).toList();
for (final s in states) {
if (axisDirectionToAxis(s.axisDirection) == Axis.vertical)
expect(s.position.maxScrollExtent, 0);
}
expect(
find.widgetWithIcon(FilledButton, Icons.check).hitTestable(),
findsOneWidget,
);
expect(find.text('Repo tasks'), findsNothing);
expect(find.text('Ideas'), findsNothing);
expect(find.byType(ActionChip), findsNothing);
});
}