fix tests
This commit is contained in:
@@ -193,9 +193,13 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
||||
child: Row(
|
||||
children: [
|
||||
StreamNeumorphicButton(
|
||||
child: StreamSvgIcon(
|
||||
assetName: 'Icon_contacts.svg',
|
||||
color: Color(0xFF006CFF),
|
||||
child: Center(
|
||||
child: StreamSvgIcon(
|
||||
assetName: 'Icon_contacts.svg',
|
||||
color: Color(0xFF006CFF),
|
||||
height: 24,
|
||||
width: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: example
|
||||
description: A new Flutter project.
|
||||
version: 1.0.68+70
|
||||
version: 1.0.69+71
|
||||
|
||||
environment:
|
||||
sdk: ">=2.2.2 <3.0.0"
|
||||
|
||||
@@ -9,20 +9,21 @@ class StreamSvgIcon extends StatelessWidget {
|
||||
final Color color;
|
||||
|
||||
const StreamSvgIcon({
|
||||
Key key,
|
||||
this.assetName,
|
||||
this.width,
|
||||
this.height,
|
||||
this.color,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final key = Key('StreamSvgIcon-$assetName');
|
||||
return kIsWeb
|
||||
? Image.network(
|
||||
'packages/stream_chat_flutter/svgs/$assetName',
|
||||
width: width,
|
||||
height: height,
|
||||
key: key,
|
||||
color: color,
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
@@ -30,6 +31,7 @@ class StreamSvgIcon extends StatelessWidget {
|
||||
: SvgPicture.asset(
|
||||
'lib/svgs/$assetName',
|
||||
package: 'stream_chat_flutter',
|
||||
key: key,
|
||||
width: width,
|
||||
height: height,
|
||||
fit: BoxFit.cover,
|
||||
|
||||
@@ -42,7 +42,8 @@ void main() {
|
||||
await tester.pump(Duration(milliseconds: 1000));
|
||||
|
||||
expect(find.byKey(Key('MessageWidget')), findsOneWidget);
|
||||
expect(find.byIcon(StreamIcons.thumbs_up_reaction), findsOneWidget);
|
||||
expect(find.byKey(Key('StreamSvgIcon-Icon_thumbs_up_reaction.svg')),
|
||||
findsOneWidget);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -91,8 +92,10 @@ void main() {
|
||||
|
||||
await tester.pump(Duration(milliseconds: 1000));
|
||||
expect(find.byKey(Key('MessageWidget')), findsOneWidget);
|
||||
expect(find.byIcon(StreamIcons.thumbs_up_reaction), findsNWidgets(2));
|
||||
expect(find.byIcon(StreamIcons.love_reaction), findsNWidgets(2));
|
||||
expect(find.byKey(Key('StreamSvgIcon-Icon_thumbs_up_reaction.svg')),
|
||||
findsNWidgets(2));
|
||||
expect(find.byKey(Key('StreamSvgIcon-Icon_love_reaction.svg')),
|
||||
findsNWidgets(2));
|
||||
expect(find.text(testUserId), findsNWidgets(2));
|
||||
},
|
||||
);
|
||||
|
||||
@@ -25,7 +25,8 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byIcon(StreamIcons.thumbs_up_reaction), findsNothing);
|
||||
expect(find.byKey(Key('StreamSvgIcon-Icon_thumbs_up_reaction.svg')),
|
||||
findsNothing);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -61,7 +62,8 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byIcon(StreamIcons.thumbs_up_reaction), findsOneWidget);
|
||||
expect(find.byKey(Key('StreamSvgIcon-Icon_thumbs_up_reaction.svg')),
|
||||
findsOneWidget);
|
||||
},
|
||||
);
|
||||
testWidgets(
|
||||
@@ -100,8 +102,10 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byIcon(StreamIcons.thumbs_up_reaction), findsOneWidget);
|
||||
expect(find.byIcon(StreamIcons.love_reaction), findsOneWidget);
|
||||
expect(find.byKey(Key('StreamSvgIcon-Icon_thumbs_up_reaction.svg')),
|
||||
findsOneWidget);
|
||||
expect(find.byKey(Key('StreamSvgIcon-Icon_love_reaction.svg')),
|
||||
findsOneWidget);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user