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.
This commit is contained in:
parent
52f897be5f
commit
d85497d91b
@ -3605,6 +3605,32 @@ void main() {
|
|||||||
expect(inkFeatures, paints..circle(color: Colors.transparent));
|
expect(inkFeatures, paints..circle(color: Colors.transparent));
|
||||||
}, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933
|
}, 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', () {
|
group('Material 2', () {
|
||||||
// These tests are only relevant for Material 2. Once Material 2
|
// These tests are only relevant for Material 2. Once Material 2
|
||||||
// support is deprecated and the APIs are removed, these tests
|
// support is deprecated and the APIs are removed, these tests
|
||||||
|
Loading…
x
Reference in New Issue
Block a user