@@ -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
/// This checks the input's configured hint text without regard to whether
@@ -351,17 +353,40 @@ void main() {
351
353
.decoration.isNotNull ().hintText.equals (contentHintText);
352
354
}
353
355
354
- group ('to ChannelNarrow' , () {
356
+ group ('to ChannelNarrow, topics not mandatory ' , () {
355
357
testWidgets ('with empty topic' , (tester) async {
356
- await prepare (tester, narrow: ChannelNarrow (channel.streamId));
358
+ await prepare (tester, narrow: ChannelNarrow (channel.streamId),
359
+ mandatoryTopics: false );
357
360
checkComposeBoxHintTexts (tester,
358
361
topicHintText: 'Topic' ,
359
362
contentHintText: 'Message #${channel .name } > (no topic)' );
360
363
});
361
364
362
365
testWidgets ('with non-empty topic' , (tester) async {
363
366
final narrow = ChannelNarrow (channel.streamId);
364
- await prepare (tester, narrow: narrow);
367
+ await prepare (tester, narrow: narrow,
368
+ mandatoryTopics: false );
369
+ await enterTopic (tester, narrow: narrow, topic: 'new topic' );
370
+ await tester.pump ();
371
+ checkComposeBoxHintTexts (tester,
372
+ topicHintText: 'Topic' ,
373
+ contentHintText: 'Message #${channel .name } > new topic' );
374
+ });
375
+ });
376
+
377
+ group ('to ChannelNarrow, mandatory topics' , () {
378
+ testWidgets ('with empty topic' , (tester) async {
379
+ await prepare (tester, narrow: ChannelNarrow (channel.streamId),
380
+ mandatoryTopics: true );
381
+ checkComposeBoxHintTexts (tester,
382
+ topicHintText: 'Topic' ,
383
+ contentHintText: 'Message #${channel .name }' );
384
+ });
385
+
386
+ testWidgets ('with non-empty topic' , (tester) async {
387
+ final narrow = ChannelNarrow (channel.streamId);
388
+ await prepare (tester, narrow: narrow,
389
+ mandatoryTopics: true );
365
390
await enterTopic (tester, narrow: narrow, topic: 'new topic' );
366
391
await tester.pump ();
367
392
checkComposeBoxHintTexts (tester,
0 commit comments