PaletteTestHost class
Test helper for isolated palette testing.
Provides easy setup and teardown with mock bridge:
late PaletteTestHost testHost;
setUp(() async {
testHost = await PaletteTestHost.create();
});
tearDown(() async {
await testHost.dispose();
});
test('shows palette', () async {
final controller = testHost.createController('test-palette');
await controller.show();
expect(testHost.mock.wasCalled('visibility', 'show'), isTrue);
});
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- host → PaletteHost
-
The palette host instance.
final
- mock → MockNativeBridge
-
The mock bridge for verifying commands and simulating events.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearCommands(
) → void - Clear all recorded commands (but keep stubs).
-
createController<
T> (String id, {PaletteConfig? config}) → PaletteController< T> - Create a palette controller for testing.
-
dispose(
) → Future< void> - Dispose the test host.
-
getController(
String id) → PaletteController? - Get an existing controller.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resetMock(
) → void - Reset mock completely (commands and stubs).
-
simulateContentReady(
String paletteId) → void - Simulate window content ready.
-
simulateEvent(
NativeEvent event) → void - Simulate a native event.
-
simulateHidden(
String paletteId) → void - Simulate palette becoming hidden.
-
simulateShown(
String paletteId) → void - Simulate palette becoming visible.
-
toString(
) → String -
A string representation of this object.
inherited
-
verifyCommand(
String service, String command, {String? windowId}) → void - Verify a command was sent.
-
verifyNoCommand(
String service, String command) → void - Verify a command was NOT sent.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
create(
{Capabilities? capabilities}) → Future< PaletteTestHost> - Create a new test host with default stubs.