This commit is contained in:
committed by
GitHub
parent
6ea4aef827
commit
a3a9a23e46
@@ -674,6 +674,42 @@ void main() {
|
||||
handle.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
group('findsAtLeastNWidgets', () {
|
||||
Widget boilerplate(Widget child) {
|
||||
return Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('succeeds when finds more then the specified count',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(boilerplate(Column(
|
||||
children: const <Widget>[Text('1'), Text('2'), Text('3')],
|
||||
)));
|
||||
|
||||
expect(find.byType(Text), findsAtLeastNWidgets(2));
|
||||
});
|
||||
|
||||
testWidgets('succeeds when finds the exact specified count',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(boilerplate(Column(
|
||||
children: const <Widget>[Text('1'), Text('2')],
|
||||
)));
|
||||
|
||||
expect(find.byType(Text), findsAtLeastNWidgets(2));
|
||||
});
|
||||
|
||||
testWidgets('fails when finds less then specified count',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(boilerplate(Column(
|
||||
children: const <Widget>[Text('1'), Text('2')],
|
||||
)));
|
||||
|
||||
expect(find.byType(Text), isNot(findsAtLeastNWidgets(3)));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
enum _ComparatorBehavior {
|
||||
|
||||
Reference in New Issue
Block a user