Files
ReelShort/test/home/root_nav_glyph_test.dart

39 lines
1.1 KiB
Dart

// Author: fruit.com.cn
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fruitshorts/core/widgets/app_root_tab.dart';
import 'package:fruitshorts/core/widgets/root_nav_glyph.dart';
import 'package:fruitshorts/l10n/app_localizations.dart';
void main() {
testWidgets(
'should_render_four_ordered_glyphs_with_home_selected_when_root_nav_builds',
(tester) async {
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: Scaffold(
bottomNavigationBar: AppRootBottomNav(
selected: AppRootTab.home,
onSelected: (_) {},
),
),
),
);
final glyphs = tester
.widgetList<RootNavGlyph>(find.byType(RootNavGlyph))
.toList();
expect(glyphs.map((glyph) => glyph.kind), RootNavGlyphKind.values);
expect(glyphs.map((glyph) => glyph.selected), [
true,
false,
false,
false,
]);
},
);
}