Dismiss command cards without a notice
Dismissing a finished command, or all of them, now just removes the cards; the SnackBar / overlay with Undo is gone.
This commit is contained in:
@@ -28,7 +28,7 @@ void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
final host = cupertino ? 'Cupertino' : 'Material';
|
||||
|
||||
testWidgets('$host: Dismiss removes a finished card and Undo restores it', (
|
||||
testWidgets('$host: Dismiss removes a finished card without a notice', (
|
||||
tester,
|
||||
) async {
|
||||
gateway.runs = [finished('run_done'), shellRecord('run_live')];
|
||||
@@ -53,34 +53,9 @@ void main() {
|
||||
]);
|
||||
expect(card(), findsOneWidget);
|
||||
expect(find.text('\$ true'), findsNothing);
|
||||
expect(notice, findsOneWidget);
|
||||
expect(find.text('Command dismissed'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('Undo'));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
expect(gateway.bodies('chat_shell_restore').single['run_ids'], [
|
||||
'run_done',
|
||||
]);
|
||||
expect(card(), findsNWidgets(2));
|
||||
expect(find.text('\$ true'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('$host: the Undo notice goes away after five seconds', (
|
||||
tester,
|
||||
) async {
|
||||
gateway.runs = [finished('run_done')];
|
||||
await tester.pumpWidget(shellThread(gateway, cupertino: cupertino));
|
||||
await tester.pump();
|
||||
await tester.tap(dismiss);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
expect(notice, findsOneWidget);
|
||||
await tester.pump(const Duration(seconds: 5));
|
||||
await tester.pumpAndSettle();
|
||||
expect(notice, findsNothing);
|
||||
expect(card(), findsNothing);
|
||||
expect(gateway.bodies('chat_shell_restore'), isEmpty);
|
||||
expect(find.text('Command dismissed'), findsNothing);
|
||||
expect(find.text('Undo'), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -137,13 +112,8 @@ void main() {
|
||||
'run_b',
|
||||
]);
|
||||
expect(card(), findsOneWidget);
|
||||
expect(find.text('2 commands dismissed'), findsOneWidget);
|
||||
// Let the SnackBar finish entering.
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
await tester.tap(find.text('Undo'));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
expect(card(), findsNWidgets(3));
|
||||
expect(find.text('2 commands dismissed'), findsNothing);
|
||||
expect(find.text('Undo'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('another client dismissing a run removes its card here', (
|
||||
@@ -156,7 +126,7 @@ void main() {
|
||||
gateway.emitDismissed('run_done');
|
||||
await tester.pump();
|
||||
expect(card(), findsNothing);
|
||||
// Its Undo there restores it here too, output read back.
|
||||
// A restore there brings it back here too, output read back.
|
||||
gateway.emitRun(finished('run_done'));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
Reference in New Issue
Block a user