Files
ReelShort/test/home/app_bottom_nav_test.dart
T

47 lines
1.3 KiB
Dart

// Author: fruit.com.cn
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fruitshorts/core/theme/app_dimens.dart';
import 'package:fruitshorts/core/widgets/app_bottom_nav.dart';
void main() {
testWidgets('should_render_64_high_navigation_and_keep_item_keys', (
tester,
) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
bottomNavigationBar: AppBottomNav(
items: [
AppBottomNavItem(
tabKey: const Key('tab-home'),
icon: Icons.movie_outlined,
selectedIcon: Icons.movie_rounded,
label: 'Home',
selected: true,
onTap: () {},
),
AppBottomNavItem(
tabKey: const Key('tab-my'),
icon: Icons.person_outline_rounded,
selectedIcon: Icons.person_rounded,
label: 'Me',
onTap: () {},
),
],
),
),
),
);
expect(find.byKey(const Key('tab-home')), findsOneWidget);
expect(find.byKey(const Key('tab-my')), findsOneWidget);
expect(find.text('Home'), findsOneWidget);
expect(
tester.getSize(find.byType(AppBottomNav)).height,
AppDimens.navHeight,
);
});
}