test sweep: kernel commands + widgets coverage, ratchet floor to 93
Add tests for `keybindings.dart` (KeyEvent → Keybinding mapping, parse-error edges, resolver entries view), `toolchain_paths.dart` (the Flutter-free `ToolchainView.resolved` static view), and several `widgets/src/` primitives: tooltip hover/overlay, palette filter + submit, multitab controller `copyWith` + size getters, and additional markdown branches (h3–h6 headings, tables, strikethrough, default block fallback, record-link tap). Unfreezes the pre-push coverage floor that was held at 90 on 2026-05-14 by mistake and ratchets to 93. Tidies eight test files that had accumulated unused imports flagged by `unnecessary_import`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,8 @@ import 'package:clide/widgets/src/clide_resize_border.dart';
|
||||
import 'package:clide/widgets/src/clide_spine.dart';
|
||||
import 'package:clide/widgets/src/icons/phosphor.dart';
|
||||
import 'package:clide/kernel/kernel.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@@ -70,6 +72,79 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(invocations, 1);
|
||||
});
|
||||
|
||||
testWidgets('typing narrows the visible commands via palette.setFilter', (tester) async {
|
||||
f.services.commands.register(CommandContribution(
|
||||
id: 'c1',
|
||||
command: 'alpha.cmd',
|
||||
title: 'Alpha',
|
||||
run: (_) async => IpcResponse.ok(id: '', data: const {}),
|
||||
));
|
||||
f.services.commands.register(CommandContribution(
|
||||
id: 'c2',
|
||||
command: 'beta.cmd',
|
||||
title: 'Beta',
|
||||
run: (_) async => IpcResponse.ok(id: '', data: const {}),
|
||||
));
|
||||
f.services.palette.open();
|
||||
await tester.pumpWidget(harness(f, Stack(children: const [ClidePalette()])));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.enterText(find.byType(EditableText), 'alpha');
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Alpha'), findsOneWidget);
|
||||
expect(find.text('Beta'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('submitting the input invokes the first filtered command', (tester) async {
|
||||
var invocations = 0;
|
||||
f.services.commands.register(CommandContribution(
|
||||
id: 'c1',
|
||||
command: 'submit.target',
|
||||
title: 'Submit Target',
|
||||
run: (_) async {
|
||||
invocations++;
|
||||
return IpcResponse.ok(id: '', data: const {});
|
||||
},
|
||||
));
|
||||
f.services.commands.register(CommandContribution(
|
||||
id: 'c2',
|
||||
command: 'other.cmd',
|
||||
title: 'Other',
|
||||
run: (_) async => IpcResponse.ok(id: '', data: const {}),
|
||||
));
|
||||
f.services.palette.open();
|
||||
await tester.pumpWidget(harness(f, Stack(children: const [ClidePalette()])));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.enterText(find.byType(EditableText), 'submit');
|
||||
await tester.pumpAndSettle();
|
||||
await tester.testTextInput.receiveAction(TextInputAction.done);
|
||||
await tester.pumpAndSettle();
|
||||
expect(invocations, 1);
|
||||
});
|
||||
|
||||
testWidgets('hovering a palette row updates its hover state', (tester) async {
|
||||
f.services.commands.register(CommandContribution(
|
||||
id: 'c1',
|
||||
command: 'hover.cmd',
|
||||
title: 'Hoverable',
|
||||
run: (_) async => IpcResponse.ok(id: '', data: const {}),
|
||||
));
|
||||
f.services.palette.open();
|
||||
await tester.pumpWidget(harness(f, Stack(children: const [ClidePalette()])));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
|
||||
addTearDown(gesture.removePointer);
|
||||
await gesture.addPointer(location: Offset.zero);
|
||||
await gesture.moveTo(tester.getCenter(find.text('Hoverable')));
|
||||
await tester.pumpAndSettle();
|
||||
// Exit again to also exercise the onExit branch.
|
||||
await gesture.moveTo(const Offset(2000, 2000));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Hoverable'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
|
||||
group('ClideFilterBox', () {
|
||||
|
||||
Reference in New Issue
Block a user