Raise the declared minimums in pubspec.yaml to what our deps already require: Flutter >=3.35.0 / Dart >=3.9.0 (was 3.19.0 / 3.5.0). alchemist 0.12 needs Flutter 3.32; Dart 3.9 first ships in Flutter 3.35, so 3.35 is the binding floor. Pin the exact build toolchain in .fvmrc (Flutter 3.44.1). Moving to the Dart 3.9 language level switches `dart format` to the new "tall" style and enables two new lints. This commit is the resulting mechanical churn, isolated from any behaviour change: - whole-tree `dart format` reformat (tall style) - `dart fix` for unnecessary_underscores + use_null_aware_elements No runtime behaviour change; `make test` green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
58 lines
2.3 KiB
Dart
58 lines
2.3 KiB
Dart
import 'package:clide/widgets/widgets.dart';
|
|
import 'package:flutter/semantics.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import '../../helpers/kernel_fixture.dart';
|
|
import '../../helpers/widget_harness.dart';
|
|
|
|
void main() {
|
|
group('ClideButton', () {
|
|
late KernelFixture f;
|
|
|
|
setUp(() async {
|
|
f = await KernelFixture.create();
|
|
});
|
|
|
|
tearDown(() async {
|
|
await f.dispose();
|
|
});
|
|
|
|
testWidgets('renders the label text', (tester) async {
|
|
await tester.pumpWidget(harness(f, const ClideButton(label: 'Save', onPressed: null)));
|
|
expect(find.text('Save'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('emits a Semantics node with button: true + label', (tester) async {
|
|
await tester.pumpWidget(harness(f, ClideButton(label: 'Commit', onPressed: () {})));
|
|
final semantics = tester.getSemantics(find.byType(ClideButton));
|
|
expect(semantics.label, 'Commit');
|
|
expect(semantics.getSemanticsData().hasAction(SemanticsAction.tap), isTrue, reason: 'enabled button must expose tap action');
|
|
});
|
|
|
|
testWidgets('semanticLabel overrides the visible label for a11y', (tester) async {
|
|
await tester.pumpWidget(harness(f, ClideButton(label: 'Save', semanticLabel: 'Save document', onPressed: () {})));
|
|
final semantics = tester.getSemantics(find.byType(ClideButton));
|
|
expect(semantics.label, 'Save document');
|
|
});
|
|
|
|
testWidgets('semanticHint propagates to the Semantics node', (tester) async {
|
|
await tester.pumpWidget(harness(f, ClideButton(label: 'Pick', semanticHint: 'Select a theme', onPressed: () {})));
|
|
final semantics = tester.getSemantics(find.byType(ClideButton));
|
|
expect(semantics.hint, 'Select a theme');
|
|
});
|
|
|
|
testWidgets('disabled button drops the tap action', (tester) async {
|
|
await tester.pumpWidget(harness(f, const ClideButton(label: 'Nope', onPressed: null)));
|
|
final semantics = tester.getSemantics(find.byType(ClideButton));
|
|
expect(semantics.getSemanticsData().hasAction(SemanticsAction.tap), isFalse);
|
|
});
|
|
|
|
testWidgets('tap invokes onPressed', (tester) async {
|
|
var pressed = 0;
|
|
await tester.pumpWidget(harness(f, ClideButton(label: 'Go', onPressed: () => pressed++)));
|
|
await tester.tap(find.byType(ClideButton));
|
|
expect(pressed, 1);
|
|
});
|
|
});
|
|
}
|