@@ -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
/// Check if the topic and content inputs use the expected hint texts.
@@ -352,17 +354,40 @@ void main() {
352
354
of: contentInputFinder, matching: find.text (contentHintText))).findsOne ();
353
355
}
354
356
355
- group ('to ChannelNarrow' , () {
357
+ group ('to ChannelNarrow, topics not mandatory ' , () {
356
358
testWidgets ('with empty topic' , (tester) async {
357
- await prepare (tester, narrow: ChannelNarrow (channel.streamId));
359
+ await prepare (tester, narrow: ChannelNarrow (channel.streamId),
360
+ mandatoryTopics: false );
358
361
checkComposeBoxHintTexts (tester,
359
362
topicHintText: 'Topic' ,
360
363
contentHintText: 'Message #${channel .name } > (no topic)' );
361
364
});
362
365
363
366
testWidgets ('with non-empty topic' , (tester) async {
364
367
final narrow = ChannelNarrow (channel.streamId);
365
- await prepare (tester, narrow: narrow);
368
+ await prepare (tester, narrow: narrow,
369
+ mandatoryTopics: false );
370
+ await enterTopic (tester, narrow: narrow, topic: 'new topic' );
371
+ await tester.pump ();
372
+ checkComposeBoxHintTexts (tester,
373
+ topicHintText: 'Topic' ,
374
+ contentHintText: 'Message #${channel .name } > new topic' );
375
+ });
376
+ });
377
+
378
+ group ('to ChannelNarrow, mandatory topics' , () {
379
+ testWidgets ('with empty topic' , (tester) async {
380
+ await prepare (tester, narrow: ChannelNarrow (channel.streamId),
381
+ mandatoryTopics: true );
382
+ checkComposeBoxHintTexts (tester,
383
+ topicHintText: 'Topic' ,
384
+ contentHintText: 'Message #${channel .name }' );
385
+ });
386
+
387
+ testWidgets ('with non-empty topic' , (tester) async {
388
+ final narrow = ChannelNarrow (channel.streamId);
389
+ await prepare (tester, narrow: narrow,
390
+ mandatoryTopics: true );
366
391
await enterTopic (tester, narrow: narrow, topic: 'new topic' );
367
392
await tester.pump ();
368
393
checkComposeBoxHintTexts (tester,
0 commit comments