@@ -24,6 +24,7 @@ import 'package:zulip/widgets/message_list.dart';
24
24
import 'package:zulip/widgets/page.dart' ;
25
25
import 'package:zulip/widgets/store.dart' ;
26
26
import 'package:zulip/widgets/channel_colors.dart' ;
27
+ import 'package:zulip/widgets/theme.dart' ;
27
28
28
29
import '../api/fake_api.dart' ;
29
30
import '../example_data.dart' as eg;
@@ -1095,6 +1096,79 @@ void main() {
1095
1096
1096
1097
debugNetworkImageHttpClientProvider = null ;
1097
1098
});
1099
+
1100
+
1101
+ group ('action sheet visual feedback' , () {
1102
+ late Message message;
1103
+
1104
+ setUp (() {
1105
+ // Create a basic message for testing
1106
+ message = eg.streamMessage ();
1107
+ });
1108
+
1109
+ // Helper function to find DecoratedBox and get its color
1110
+ Color ? getBackgroundColor (WidgetTester tester) {
1111
+ final decoratedBox = tester.widget <DecoratedBox >(
1112
+ find.descendant (
1113
+ of: find.byType (MessageWithPossibleSender ),
1114
+ matching: find.byType (DecoratedBox ),
1115
+ ),
1116
+ );
1117
+ return (decoratedBox.decoration as BoxDecoration ).color;
1118
+ }
1119
+
1120
+ Future <void > buildTestWidget (WidgetTester tester) async {
1121
+ await setupMessageListPage (
1122
+ tester,
1123
+ messages: [message],
1124
+ );
1125
+ }
1126
+
1127
+ testWidgets ('starts with transparent background' , (tester) async {
1128
+ await buildTestWidget (tester);
1129
+
1130
+ expect (
1131
+ getBackgroundColor (tester),
1132
+ equals (Colors .transparent),
1133
+ reason: 'Message should start with transparent background' ,
1134
+ );
1135
+ });
1136
+
1137
+ testWidgets ('shows tint color when long pressed' , (tester) async {
1138
+ await buildTestWidget (tester);
1139
+
1140
+ // Trigger long press
1141
+ await tester.longPress (find.byType (MessageWithPossibleSender ));
1142
+ await tester.pump ();
1143
+
1144
+ final expectedTint = DesignVariables .of (tester.element (find.byType (MessageWithPossibleSender )))
1145
+ .pressedTint;
1146
+
1147
+ expect (
1148
+ getBackgroundColor (tester),
1149
+ equals (expectedTint),
1150
+ reason: 'Message should show tint color during long press' ,
1151
+ );
1152
+ });
1153
+
1154
+ testWidgets ('returns to transparent after action sheet dismissal' , (tester) async {
1155
+ await buildTestWidget (tester);
1156
+
1157
+ // Open action sheet
1158
+ await tester.longPress (find.byType (MessageWithPossibleSender ));
1159
+ await tester.pump ();
1160
+
1161
+ // Simulate action sheet dismissal by tapping outside
1162
+ await tester.tapAt (const Offset (0 , 0 ));
1163
+ await tester.pumpAndSettle ();
1164
+
1165
+ expect (
1166
+ getBackgroundColor (tester),
1167
+ equals (Colors .transparent),
1168
+ reason: 'Message should return to transparent after dismissal' ,
1169
+ );
1170
+ });
1171
+ });
1098
1172
});
1099
1173
1100
1174
group ('Starred messages' , () {
0 commit comments