Files
pipelines/app/test/shell/shell_destination_menu_test.dart
T

35 lines
1.2 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/shell_destination_menu.dart';
import 'package:pipelines_app/shell/destination.dart';
void main() {
for (final cupertino in [false, true]) {
testWidgets('compact menu exposes all named destinations ($cupertino)', (
tester,
) async {
AppDestination? selected;
final menu = ShellDestinationMenu(
cupertino: cupertino,
current: AppDestination.chat,
onSelected: (value) => selected = value,
);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: menu))
: MaterialApp(home: Scaffold(body: menu)),
);
await tester.tap(find.text('Menu'));
await tester.pumpAndSettle();
for (final name in ['Pipelines', 'Runs', 'Chat', 'Search', 'Settings']) {
expect(find.text(name), findsOneWidget);
}
await tester.tap(find.text('Runs'));
await tester.pumpAndSettle();
expect(selected, AppDestination.runs);
expect(tester.takeException(), isNull);
});
}
}