Unverified Commit d85497d9 authored by Qun Cheng's avatar Qun Cheng Committed by GitHub

Add a unit test for `NavigationRail` (#143108)

Adding `SingleChildScrollView` to `NavigationRail` may cause exception if the nav rail has some expanded widgets inside, like the issue: https://github.com/flutter/flutter/issues/143061. This PR is just to add a unit test to avoid causing this breaking again.
parent 52f897be
......@@ -3605,6 +3605,32 @@ void main() {
expect(inkFeatures, paints..circle(color: Colors.transparent));
}, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933
testWidgets('Navigation rail can have expanded widgets inside', (WidgetTester tester) async {
await _pumpNavigationRail(
tester,
navigationRail: NavigationRail(
selectedIndex: 0,
destinations: const <NavigationRailDestination>[
NavigationRailDestination(
icon: Icon(Icons.favorite_border),
label: Text('Abc'),
),
NavigationRailDestination(
icon: Icon(Icons.bookmark_border),
label: Text('Bcd'),
),
],
trailing: const Expanded(
child: Icon(Icons.search),
),
),
);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
});
group('Material 2', () {
// These tests are only relevant for Material 2. Once Material 2
// support is deprecated and the APIs are removed, these tests
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment