@@ -108,21 +108,26 @@ void main() {
108
108
}
109
109
110
110
group ('topic action sheet' , () {
111
+ final someChannel = eg.stream ();
112
+ const someTopic = 'my topic' ;
113
+
111
114
group ('showTopicActionSheet' , () {
112
- final channel = eg.stream ();
113
- const topic = 'my topic' ;
114
115
final message = eg.streamMessage (
115
- stream: channel , topic: topic , sender: eg.otherUser);
116
+ stream: someChannel , topic: someTopic , sender: eg.otherUser);
116
117
117
118
Future <void > prepare ({
119
+ ZulipStream ? channel,
120
+ String topic = someTopic,
118
121
UnreadMessagesSnapshot ? unreadMsgs,
119
122
}) async {
123
+ final effectiveChannel = channel ?? someChannel;
124
+
120
125
addTearDown (testBinding.reset);
121
126
122
127
await testBinding.globalStore.add (eg.selfAccount, eg.initialSnapshot (
123
128
realmUsers: [eg.selfUser, eg.otherUser],
124
- streams: [channel ],
125
- subscriptions: [eg.subscription (channel )],
129
+ streams: [effectiveChannel ],
130
+ subscriptions: [eg.subscription (effectiveChannel )],
126
131
unreadMsgs: unreadMsgs));
127
132
store = await testBinding.globalStore.perAccount (eg.selfAccount.id);
128
133
connection = store.connection as FakeApiConnection ;
@@ -144,16 +149,16 @@ void main() {
144
149
testWidgets ('show from inbox' , (tester) async {
145
150
await prepare (unreadMsgs: eg.unreadMsgs (count: 1 ,
146
151
channels: [eg.unreadChannelMsgs (
147
- streamId: channel .streamId,
148
- topic: topic ,
152
+ streamId: someChannel .streamId,
153
+ topic: someTopic ,
149
154
unreadMessageIds: [message.id],
150
155
)]));
151
156
await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount.id,
152
157
child: const HomePage ()));
153
158
await tester.pump ();
154
159
check (find.byType (InboxPageBody )).findsOne ();
155
160
156
- await tester.longPress (find.text (topic ));
161
+ await tester.longPress (find.text (someTopic ));
157
162
// sheet appears onscreen; default duration of bottom-sheet enter animation
158
163
await tester.pump (const Duration (milliseconds: 250 ));
159
164
checkButtons ();
@@ -165,11 +170,13 @@ void main() {
165
170
foundOldest: true , messages: [message]).toJson ());
166
171
await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount.id,
167
172
child: MessageListPage (
168
- initNarrow: eg.topicNarrow (channel .streamId, topic ))));
173
+ initNarrow: eg.topicNarrow (someChannel .streamId, someTopic ))));
169
174
// global store, per-account store, and message list get loaded
170
175
await tester.pumpAndSettle ();
171
176
172
- final topicRow = find.descendant (of: find.byType (ZulipAppBar ), matching: find.text (topic));
177
+ final topicRow = find.descendant (
178
+ of: find.byType (ZulipAppBar ),
179
+ matching: find.text (someTopic));
173
180
await tester.longPress (topicRow);
174
181
// sheet appears onscreen; default duration of bottom-sheet enter animation
175
182
await tester.pump (const Duration (milliseconds: 250 ));
@@ -186,7 +193,7 @@ void main() {
186
193
await tester.pumpAndSettle ();
187
194
188
195
await tester.longPress (find.descendant (
189
- of: find.byType (RecipientHeader ), matching: find.text (topic )));
196
+ of: find.byType (RecipientHeader ), matching: find.text (someTopic )));
190
197
// sheet appears onscreen; default duration of bottom-sheet enter animation
191
198
await tester.pump (const Duration (milliseconds: 250 ));
192
199
checkButtons ();
0 commit comments