add message_action_modal_test
This commit is contained in:
@@ -30,20 +30,19 @@ class MessageActionsModal extends StatelessWidget {
|
||||
Key key,
|
||||
@required this.message,
|
||||
@required this.messageTheme,
|
||||
this.showReactions,
|
||||
this.showDeleteMessage,
|
||||
this.showEditMessage,
|
||||
this.showReactions = true,
|
||||
this.showDeleteMessage = true,
|
||||
this.showEditMessage = true,
|
||||
this.onThreadTap,
|
||||
this.showCopyMessage = true,
|
||||
this.showReply,
|
||||
this.showReply = true,
|
||||
this.editMessageInputBuilder,
|
||||
this.messageShape,
|
||||
this.reverse,
|
||||
this.reverse = false,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final channel = StreamChannel.of(context).channel;
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
@@ -78,6 +77,7 @@ class MessageActionsModal extends StatelessWidget {
|
||||
),
|
||||
AbsorbPointer(
|
||||
child: MessageWidget(
|
||||
key: Key('MessageWidget'),
|
||||
reverse: reverse,
|
||||
message: message,
|
||||
messageTheme: messageTheme,
|
||||
@@ -277,7 +277,7 @@ class MessageActionsModal extends StatelessWidget {
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
leading: Icon(
|
||||
StreamIcons.Thread_Reply,
|
||||
StreamIcons.sorting_up,
|
||||
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
||||
),
|
||||
onTap: () {
|
||||
|
||||
@@ -15,11 +15,8 @@ class MessageReactionsModal extends StatelessWidget {
|
||||
final void Function(Message) onThreadTap;
|
||||
final Message message;
|
||||
final MessageTheme messageTheme;
|
||||
final bool showReactions;
|
||||
final bool showDeleteMessage;
|
||||
final bool showEditMessage;
|
||||
final bool showReply;
|
||||
final bool reverse;
|
||||
final bool showReactions;
|
||||
final ShapeBorder messageShape;
|
||||
final void Function(User) onUserAvatarTap;
|
||||
|
||||
@@ -28,10 +25,7 @@ class MessageReactionsModal extends StatelessWidget {
|
||||
@required this.message,
|
||||
@required this.messageTheme,
|
||||
this.showReactions = true,
|
||||
this.showDeleteMessage,
|
||||
this.showEditMessage,
|
||||
this.onThreadTap,
|
||||
this.showReply,
|
||||
this.editMessageInputBuilder,
|
||||
this.messageShape,
|
||||
this.reverse = false,
|
||||
@@ -74,6 +68,7 @@ class MessageReactionsModal extends StatelessWidget {
|
||||
),
|
||||
AbsorbPointer(
|
||||
child: MessageWidget(
|
||||
key: Key('MessageWidget'),
|
||||
reverse: reverse,
|
||||
message: message,
|
||||
messageTheme: messageTheme,
|
||||
|
||||
@@ -489,14 +489,10 @@ class _MessageWidgetState extends State<MessageWidget> {
|
||||
messageTheme: widget.messageTheme,
|
||||
messageShape: widget.shape ?? _getDefaultShape(context),
|
||||
reverse: widget.reverse,
|
||||
showDeleteMessage: widget.showDeleteMessage,
|
||||
message: widget.message,
|
||||
editMessageInputBuilder: widget.editMessageInputBuilder,
|
||||
onThreadTap: widget.onThreadTap,
|
||||
showEditMessage: widget.showEditMessage,
|
||||
showReactions: widget.showReactions,
|
||||
showReply:
|
||||
widget.showReplyIndicator && widget.onThreadTap != null,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -365,7 +365,7 @@ class StreamChatThemeData {
|
||||
),
|
||||
ReactionIcon(
|
||||
type: 'thumbs_down',
|
||||
iconData: StreamIcons.thumbs_up_reaction_1,
|
||||
iconData: StreamIcons.thumbs_down_reaction,
|
||||
),
|
||||
ReactionIcon(
|
||||
type: 'lol',
|
||||
|
||||
+60
-65
@@ -461,32 +461,32 @@ class StreamIcons {
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData grey600 = IconData(
|
||||
static const IconData grid = IconData(
|
||||
0xe95b,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData grid = IconData(
|
||||
static const IconData group = IconData(
|
||||
0xe95c,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData heart_outline_add = IconData(
|
||||
static const IconData heart_1 = IconData(
|
||||
0xe95d,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData heart_outline_delete = IconData(
|
||||
static const IconData heart_outline_add = IconData(
|
||||
0xe95e,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData heart_pill = IconData(
|
||||
static const IconData heart_outline_delete = IconData(
|
||||
0xe95f,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData heart_1 = IconData(
|
||||
static const IconData heart_pill = IconData(
|
||||
0xe960,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
@@ -521,127 +521,127 @@ class StreamIcons {
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData hourglass_full_1 = IconData(
|
||||
static const IconData hourglass_full = IconData(
|
||||
0xe967,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData hourglass_full = IconData(
|
||||
static const IconData hourglass = IconData(
|
||||
0xe968,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData hourglass = IconData(
|
||||
static const IconData insurance_outline = IconData(
|
||||
0xe969,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData insurance_outline = IconData(
|
||||
static const IconData insurance = IconData(
|
||||
0xe96a,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData insurance = IconData(
|
||||
static const IconData left_right = IconData(
|
||||
0xe96b,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData left_right = IconData(
|
||||
static const IconData left = IconData(
|
||||
0xe96c,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData left = IconData(
|
||||
static const IconData light = IconData(
|
||||
0xe96d,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData light = IconData(
|
||||
static const IconData lightning = IconData(
|
||||
0xe96e,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData lightning = IconData(
|
||||
static const IconData link = IconData(
|
||||
0xe96f,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData link = IconData(
|
||||
static const IconData location_map = IconData(
|
||||
0xe970,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData location_map = IconData(
|
||||
static const IconData location = IconData(
|
||||
0xe971,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData location = IconData(
|
||||
static const IconData LOL_reaction = IconData(
|
||||
0xe972,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData LOL_reaction = IconData(
|
||||
static const IconData love_reaction = IconData(
|
||||
0xe973,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData love_reaction = IconData(
|
||||
static const IconData love = IconData(
|
||||
0xe974,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData love = IconData(
|
||||
static const IconData lungs = IconData(
|
||||
0xe975,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData lungs = IconData(
|
||||
static const IconData mail_open = IconData(
|
||||
0xe976,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData mail_open = IconData(
|
||||
static const IconData mail = IconData(
|
||||
0xe977,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData mail = IconData(
|
||||
static const IconData male = IconData(
|
||||
0xe978,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData male = IconData(
|
||||
static const IconData medical_bed = IconData(
|
||||
0xe979,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData medical_bed = IconData(
|
||||
static const IconData medical_blank = IconData(
|
||||
0xe97a,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData medical_blank = IconData(
|
||||
static const IconData medical_card_add = IconData(
|
||||
0xe97b,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData medical_card_add = IconData(
|
||||
static const IconData medical_card = IconData(
|
||||
0xe97c,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData medical_card = IconData(
|
||||
static const IconData medical_cross = IconData(
|
||||
0xe97d,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData medical_cross = IconData(
|
||||
static const IconData medical_load = IconData(
|
||||
0xe97e,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData medical_load = IconData(
|
||||
static const IconData menu_point_1 = IconData(
|
||||
0xe97f,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
@@ -651,22 +651,22 @@ class StreamIcons {
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData menu_point_1 = IconData(
|
||||
static const IconData menu_point = IconData(
|
||||
0xe981,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData menu_point = IconData(
|
||||
static const IconData menu = IconData(
|
||||
0xe982,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData menu = IconData(
|
||||
static const IconData message = IconData(
|
||||
0xe983,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData message = IconData(
|
||||
static const IconData mic_1 = IconData(
|
||||
0xe984,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
@@ -886,12 +886,12 @@ class StreamIcons {
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData save_check = IconData(
|
||||
static const IconData save_1 = IconData(
|
||||
0xe9b0,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData save_1 = IconData(
|
||||
static const IconData save_check = IconData(
|
||||
0xe9b1,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
@@ -1061,17 +1061,17 @@ class StreamIcons {
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData Thread_Reply = IconData(
|
||||
static const IconData thumbs_down_reaction = IconData(
|
||||
0xe9d3,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData thumbs_up_reaction_1 = IconData(
|
||||
static const IconData thumbs_up_reaction = IconData(
|
||||
0xe9d4,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData thumbs_up_reaction = IconData(
|
||||
static const IconData time_1 = IconData(
|
||||
0xe9d5,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
@@ -1081,109 +1081,104 @@ class StreamIcons {
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData time_1 = IconData(
|
||||
static const IconData time = IconData(
|
||||
0xe9d7,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData time = IconData(
|
||||
static const IconData tooth = IconData(
|
||||
0xe9d8,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData tooth = IconData(
|
||||
static const IconData tube_full = IconData(
|
||||
0xe9d9,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData tube_full = IconData(
|
||||
static const IconData tv_check = IconData(
|
||||
0xe9da,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData tv_check = IconData(
|
||||
static const IconData tv_rating = IconData(
|
||||
0xe9db,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData tv_rating = IconData(
|
||||
static const IconData unfold_less_h = IconData(
|
||||
0xe9dc,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData unfold_less_h = IconData(
|
||||
static const IconData unfold_less = IconData(
|
||||
0xe9dd,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData unfold_less = IconData(
|
||||
static const IconData unfold_more_h = IconData(
|
||||
0xe9de,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData unfold_more_h = IconData(
|
||||
static const IconData unfold_more = IconData(
|
||||
0xe9df,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData unfold_more = IconData(
|
||||
static const IconData unread = IconData(
|
||||
0xe9e0,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData unread = IconData(
|
||||
static const IconData up_down = IconData(
|
||||
0xe9e1,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData up_down = IconData(
|
||||
static const IconData up = IconData(
|
||||
0xe9e2,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData up = IconData(
|
||||
static const IconData upload = IconData(
|
||||
0xe9e3,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData upload = IconData(
|
||||
static const IconData user_add = IconData(
|
||||
0xe9e4,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData user_add = IconData(
|
||||
static const IconData user_delete = IconData(
|
||||
0xe9e5,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData user_delete = IconData(
|
||||
static const IconData user_minus = IconData(
|
||||
0xe9e6,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData user_minus = IconData(
|
||||
static const IconData user = IconData(
|
||||
0xe9e7,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData user = IconData(
|
||||
static const IconData voice = IconData(
|
||||
0xe9e8,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData voice = IconData(
|
||||
static const IconData world = IconData(
|
||||
0xe9e9,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData world = IconData(
|
||||
static const IconData wut_reaction = IconData(
|
||||
0xe9ea,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
static const IconData wut_reaction = IconData(
|
||||
0xe9eb,
|
||||
fontFamily: _fontFamily,
|
||||
fontPackage: _fontPackage,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:stream_chat_flutter/src/message_reactions_modal.dart';
|
||||
import 'package:stream_chat_flutter/src/message_actions_modal.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
import 'mocks.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'it should show two reactions',
|
||||
'it should show the all actions',
|
||||
(WidgetTester tester) async {
|
||||
final client = MockClient();
|
||||
final clientState = MockClientState();
|
||||
@@ -25,22 +25,12 @@ void main() {
|
||||
streamChatThemeData: streamTheme,
|
||||
client: client,
|
||||
child: Container(
|
||||
child: MessageReactionsModal(
|
||||
child: MessageActionsModal(
|
||||
message: Message(
|
||||
text: 'test',
|
||||
user: User(
|
||||
id: 'user-id',
|
||||
),
|
||||
latestReactions: [
|
||||
Reaction(
|
||||
type: 'thumbs_up',
|
||||
user: User(id: 'test'),
|
||||
),
|
||||
Reaction(
|
||||
type: 'love',
|
||||
user: User(id: 'test'),
|
||||
),
|
||||
],
|
||||
),
|
||||
messageTheme: streamTheme.ownMessageTheme,
|
||||
),
|
||||
@@ -50,9 +40,55 @@ void main() {
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byIcon(StreamIcons.thumbs_up_reaction), findsNWidgets(2));
|
||||
expect(find.byIcon(StreamIcons.love_reaction), findsNWidgets(2));
|
||||
expect(find.text('test'), findsNWidgets(2));
|
||||
expect(find.byKey(Key('MessageWidget')), findsOneWidget);
|
||||
expect(find.byIcon(StreamIcons.sorting_up), findsOneWidget);
|
||||
expect(find.byIcon(StreamIcons.edit), findsOneWidget);
|
||||
expect(find.byIcon(StreamIcons.delete), findsOneWidget);
|
||||
expect(find.byIcon(StreamIcons.copy), findsOneWidget);
|
||||
},
|
||||
);
|
||||
testWidgets(
|
||||
'it should show some actions',
|
||||
(WidgetTester tester) async {
|
||||
final client = MockClient();
|
||||
final clientState = MockClientState();
|
||||
|
||||
when(client.state).thenReturn(clientState);
|
||||
when(clientState.user).thenReturn(OwnUser(id: 'user-id'));
|
||||
|
||||
final themeData = ThemeData();
|
||||
final streamTheme = StreamChatThemeData.getDefaultTheme(themeData);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: themeData,
|
||||
home: StreamChat(
|
||||
streamChatThemeData: streamTheme,
|
||||
client: client,
|
||||
child: Container(
|
||||
child: MessageActionsModal(
|
||||
showEditMessage: false,
|
||||
showCopyMessage: false,
|
||||
showDeleteMessage: false,
|
||||
showReply: false,
|
||||
message: Message(
|
||||
text: 'test',
|
||||
user: User(
|
||||
id: 'user-id',
|
||||
),
|
||||
),
|
||||
messageTheme: streamTheme.ownMessageTheme,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byKey(Key('MessageWidget')), findsOneWidget);
|
||||
expect(find.byIcon(StreamIcons.sorting_up), findsNothing);
|
||||
expect(find.byIcon(StreamIcons.edit), findsNothing);
|
||||
expect(find.byIcon(StreamIcons.delete), findsNothing);
|
||||
expect(find.byIcon(StreamIcons.copy), findsNothing);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,21 +17,21 @@ void main() {
|
||||
theme: themeData,
|
||||
home: StreamChatTheme(
|
||||
data: streamTheme,
|
||||
child: Container(
|
||||
child: MessageReactionsModal(
|
||||
message: Message(
|
||||
text: 'test',
|
||||
user: User(
|
||||
id: 'test-user',
|
||||
),
|
||||
child: MessageReactionsModal(
|
||||
message: Message(
|
||||
id: 'test',
|
||||
text: 'test message',
|
||||
user: User(
|
||||
id: 'test-user',
|
||||
),
|
||||
messageTheme: streamTheme.ownMessageTheme,
|
||||
),
|
||||
messageTheme: streamTheme.ownMessageTheme,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byKey(Key('MessageWidget')), findsOneWidget);
|
||||
expect(find.byIcon(StreamIcons.thumbs_up_reaction), findsOneWidget);
|
||||
},
|
||||
);
|
||||
@@ -47,41 +47,42 @@ void main() {
|
||||
|
||||
final themeData = ThemeData();
|
||||
final streamTheme = StreamChatThemeData.getDefaultTheme(themeData);
|
||||
final testUserId = 'test user';
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: themeData,
|
||||
home: StreamChat(
|
||||
streamChatThemeData: streamTheme,
|
||||
client: client,
|
||||
child: Container(
|
||||
child: MessageReactionsModal(
|
||||
message: Message(
|
||||
text: 'test',
|
||||
user: User(
|
||||
id: 'test-user',
|
||||
),
|
||||
latestReactions: [
|
||||
Reaction(
|
||||
type: 'thumbs_up',
|
||||
user: User(id: 'test'),
|
||||
),
|
||||
Reaction(
|
||||
type: 'love',
|
||||
user: User(id: 'test'),
|
||||
),
|
||||
],
|
||||
child: MessageReactionsModal(
|
||||
message: Message(
|
||||
text: 'test message',
|
||||
user: User(
|
||||
id: 'test-user',
|
||||
),
|
||||
messageTheme: streamTheme.ownMessageTheme,
|
||||
latestReactions: [
|
||||
Reaction(
|
||||
type: 'thumbs_up',
|
||||
user: User(id: testUserId),
|
||||
),
|
||||
Reaction(
|
||||
type: 'love',
|
||||
user: User(id: testUserId),
|
||||
),
|
||||
],
|
||||
),
|
||||
messageTheme: streamTheme.ownMessageTheme,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
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.text('test'), findsNWidgets(2));
|
||||
expect(find.text(testUserId), findsNWidgets(2));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user