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