Skip to content

Commit b264a7e

Browse files
committed
Ensure that navigation rail index update when icon button is pressed
1 parent 4dad60d commit b264a7e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/providers/ui_providers_test.dart

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,26 @@ void main() {
8989
expect(find.byType(IntroPage), findsNothing);
9090
expect(find.byType(HomePage), findsNothing);
9191
});
92+
93+
testWidgets(
94+
'Navigation Rail index should update when icon button is pressed',
95+
(tester) async {
96+
await tester.pumpWidget(
97+
const ProviderScope(
98+
child: MaterialApp(
99+
home: Dashboard(),
100+
),
101+
),
102+
);
103+
104+
// Tap on the Intro icon
105+
await tester.tap(find.byIcon(Icons.help_outline));
106+
await tester.pump();
107+
108+
// Verify that the navRailIndexStateProvider is updated
109+
final dashboard = tester.element(find.byType(Dashboard));
110+
final container = ProviderScope.containerOf(dashboard);
111+
expect(container.read(navRailIndexStateProvider), 1);
112+
});
92113
});
93114
}

0 commit comments

Comments
 (0)