fix(tests): update feedback_dialogs test for queue implementation
This commit is contained in:
@@ -9,6 +9,12 @@ enum _FeedbackKind { error, success, info }
|
||||
final _queue = Queue<_FeedbackRequest>();
|
||||
bool _isShowing = false;
|
||||
|
||||
@visibleForTesting
|
||||
void resetFeedbackDialogQueue() {
|
||||
_queue.clear();
|
||||
_isShowing = false;
|
||||
}
|
||||
|
||||
class _FeedbackRequest {
|
||||
final BuildContext context;
|
||||
final String messageKey;
|
||||
|
||||
@@ -1,36 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:sf_shared/testing.dart';
|
||||
|
||||
// Only the error variant is smoke-tested. success/info rely on Timer + Navigator.pop
|
||||
// and hit cross-test SFLocalizations state, so they're covered by feature integration
|
||||
// tests (Fase 1+) instead.
|
||||
void main() {
|
||||
testWidgets('showErrorDialog displays AlertDialog with an accept button', (tester) async {
|
||||
await pumpApp(
|
||||
tester,
|
||||
withLocalizations: true,
|
||||
child: Builder(
|
||||
builder: (ctx) => ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: const Text('go'),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
setUp(resetFeedbackDialogQueue);
|
||||
|
||||
final ctx = tester.element(find.text('go'));
|
||||
final future = showErrorDialog(ctx, I18n.errorInvalidCredentials);
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(AlertDialog), findsOneWidget);
|
||||
expect(find.byType(TextButton), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byType(TextButton));
|
||||
await tester.pump();
|
||||
await future;
|
||||
test('resetFeedbackDialogQueue clears state', () {
|
||||
resetFeedbackDialogQueue();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user