@@ -326,11 +326,13 @@ void main() {
326
326
327
327
Future <void > prepare (WidgetTester tester, {
328
328
required Narrow narrow,
329
+ bool ? mandatoryTopics,
329
330
}) async {
330
331
await prepareComposeBox (tester,
331
332
narrow: narrow,
332
333
otherUsers: [eg.otherUser, eg.thirdUser],
333
- streams: [channel]);
334
+ streams: [channel],
335
+ mandatoryTopics: mandatoryTopics);
334
336
}
335
337
336
338
void checkComposeBoxHintTexts (WidgetTester tester, {
@@ -347,17 +349,19 @@ void main() {
347
349
of: contentInputFinder, matching: find.text (contentHintText))).findsOne ();
348
350
}
349
351
350
- group ('to ChannelNarrow' , () {
352
+ group ('to ChannelNarrow, topics not mandatory ' , () {
351
353
testWidgets ('with empty topic' , (tester) async {
352
- await prepare (tester, narrow: ChannelNarrow (channel.streamId));
354
+ await prepare (tester, narrow: ChannelNarrow (channel.streamId),
355
+ mandatoryTopics: false );
353
356
checkComposeBoxHintTexts (tester,
354
357
topicHintText: 'Topic' ,
355
358
contentHintText: 'Message #${channel .name } > (no topic)' );
356
359
});
357
360
358
361
testWidgets ('with non-empty topic' , (tester) async {
359
362
final narrow = ChannelNarrow (channel.streamId);
360
- await prepare (tester, narrow: narrow);
363
+ await prepare (tester, narrow: narrow,
364
+ mandatoryTopics: false );
361
365
await enterTopic (tester, narrow: narrow, topic: 'new topic' );
362
366
await tester.pump ();
363
367
checkComposeBoxHintTexts (tester,
@@ -366,6 +370,25 @@ void main() {
366
370
});
367
371
});
368
372
373
+ testWidgets ('to ChannelNarrow, mandatory topics with empty topic' , (tester) async {
374
+ await prepare (tester, narrow: ChannelNarrow (channel.streamId),
375
+ mandatoryTopics: true );
376
+ checkComposeBoxHintTexts (tester,
377
+ topicHintText: 'Topic' ,
378
+ contentHintText: 'Message #${channel .name }' );
379
+ });
380
+
381
+ testWidgets ('to ChannelNarrow, mandatory topics with non-empty topic' , (tester) async {
382
+ final narrow = ChannelNarrow (channel.streamId);
383
+ await prepare (tester, narrow: narrow,
384
+ mandatoryTopics: true );
385
+ await enterTopic (tester, narrow: narrow, topic: 'new topic' );
386
+ await tester.pump ();
387
+ checkComposeBoxHintTexts (tester,
388
+ topicHintText: 'Topic' ,
389
+ contentHintText: 'Message #${channel .name } > new topic' );
390
+ });
391
+
369
392
testWidgets ('to TopicNarrow' , (tester) async {
370
393
await prepare (tester,
371
394
narrow: TopicNarrow (channel.streamId, TopicName ('topic' )));
0 commit comments