merge: land flutter/motion
This commit is contained in:
@@ -56,7 +56,10 @@ void main() {
|
||||
expect(badge, findsOneWidget);
|
||||
expect(tester.widget<Badge>(badge).isLabelVisible, isFalse);
|
||||
expect(
|
||||
find.descendant(of: badge, matching: find.byType(Text)),
|
||||
find.descendant(
|
||||
of: badge,
|
||||
matching: find.textContaining(RegExp(r'\d')),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
expect(find.bySemanticsLabel(anyAttention), findsNothing);
|
||||
|
||||
@@ -94,7 +94,7 @@ void main() {
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey('shell.badge.chat.unread')),
|
||||
matching: find.byType(Text),
|
||||
matching: find.textContaining(RegExp(r'\d')),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/motion/motion.dart';
|
||||
|
||||
Widget _list(List<String> ids, {bool reduce = false}) => Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: MediaQuery(
|
||||
data: MediaQueryData(disableAnimations: reduce),
|
||||
child: ArrivalScope(
|
||||
ids: ids,
|
||||
child: Column(
|
||||
children: [
|
||||
for (final id in ids)
|
||||
Arrival(key: ValueKey(id), id: id, child: Text(id)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Finder _fadeOf(String id) =>
|
||||
find.ancestor(of: find.text(id), matching: find.byType(FadeTransition));
|
||||
|
||||
void main() {
|
||||
testWidgets('only items after the first load fade in', (tester) async {
|
||||
await tester.pumpWidget(_list(['a', 'b']));
|
||||
expect(_fadeOf('a'), findsNothing);
|
||||
|
||||
await tester.pumpWidget(_list(['c', 'a', 'b']));
|
||||
expect(_fadeOf('c'), findsOneWidget);
|
||||
expect(_fadeOf('a'), findsNothing);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('reduced motion shows arrivals at once', (tester) async {
|
||||
await tester.pumpWidget(_list(['a'], reduce: true));
|
||||
await tester.pumpWidget(_list(['b', 'a'], reduce: true));
|
||||
expect(_fadeOf('b'), findsNothing);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user