@@ -47,15 +47,18 @@ void main() {
47
47
List <User > otherUsers = const [],
48
48
List <ZulipStream > streams = const [],
49
49
bool ? mandatoryTopics,
50
+ int ? zulipFeatureLevel,
50
51
}) async {
51
52
if (narrow case ChannelNarrow (: var streamId) || TopicNarrow (: var streamId)) {
52
53
assert (streams.any ((stream) => stream.streamId == streamId),
53
54
'Add a channel with "streamId" the same as of $narrow .streamId to the store.' );
54
55
}
55
56
addTearDown (testBinding.reset);
56
57
selfUser ?? = eg.selfUser;
57
- final selfAccount = eg.account (user: selfUser);
58
+ zulipFeatureLevel ?? = eg.futureZulipFeatureLevel;
59
+ final selfAccount = eg.account (user: selfUser, zulipFeatureLevel: zulipFeatureLevel);
58
60
await testBinding.globalStore.add (selfAccount, eg.initialSnapshot (
61
+ zulipFeatureLevel: zulipFeatureLevel,
59
62
realmMandatoryTopics: mandatoryTopics,
60
63
));
61
64
@@ -327,12 +330,14 @@ void main() {
327
330
Future <void > prepare (WidgetTester tester, {
328
331
required Narrow narrow,
329
332
bool ? mandatoryTopics,
333
+ int ? zulipFeatureLevel,
330
334
}) async {
331
335
await prepareComposeBox (tester,
332
336
narrow: narrow,
333
337
otherUsers: [eg.otherUser, eg.thirdUser],
334
338
streams: [channel],
335
- mandatoryTopics: mandatoryTopics);
339
+ mandatoryTopics: mandatoryTopics,
340
+ zulipFeatureLevel: zulipFeatureLevel);
336
341
}
337
342
338
343
/// This checks the input's configured hint text without regard to whether
@@ -355,8 +360,18 @@ void main() {
355
360
356
361
group ('to ChannelNarrow, topics not mandatory' , () {
357
362
testWidgets ('with empty topic' , (tester) async {
363
+ final narrow = ChannelNarrow (channel.streamId);
364
+ await prepare (tester, narrow: narrow, mandatoryTopics: false );
365
+ await tester.pump ();
366
+ checkComposeBoxHintTexts (tester,
367
+ topicHintText: 'Topic' ,
368
+ contentHintText: 'Message #${channel .name } > ${eg .defaultRealmEmptyTopicDisplayName }' );
369
+ }, skip: true ); // null topic names soon to be enabled
370
+
371
+ testWidgets ('legacy: with empty topic' , (tester) async {
358
372
await prepare (tester, narrow: ChannelNarrow (channel.streamId),
359
- mandatoryTopics: false );
373
+ mandatoryTopics: false ,
374
+ zulipFeatureLevel: 333 );
360
375
checkComposeBoxHintTexts (tester,
361
376
topicHintText: 'Topic' ,
362
377
contentHintText: 'Message #${channel .name } > (no topic)' );
@@ -381,6 +396,15 @@ void main() {
381
396
checkComposeBoxHintTexts (tester,
382
397
topicHintText: 'Topic' ,
383
398
contentHintText: 'Message #${channel .name }' );
399
+ }, skip: true ); // null topic names soon to be enabled
400
+
401
+ testWidgets ('legacy: with empty topic' , (tester) async {
402
+ await prepare (tester, narrow: ChannelNarrow (channel.streamId),
403
+ mandatoryTopics: true ,
404
+ zulipFeatureLevel: 333 );
405
+ checkComposeBoxHintTexts (tester,
406
+ topicHintText: 'Topic' ,
407
+ contentHintText: 'Message #${channel .name }' );
384
408
});
385
409
386
410
testWidgets ('with non-empty topic' , (tester) async {
@@ -395,13 +419,22 @@ void main() {
395
419
});
396
420
});
397
421
398
- testWidgets ('to TopicNarrow' , (tester) async {
422
+ testWidgets ('to TopicNarrow with non-empty topic ' , (tester) async {
399
423
await prepare (tester,
400
- narrow: TopicNarrow (channel.streamId, TopicName ('topic' )));
424
+ narrow: TopicNarrow (channel.streamId, TopicName ('topic' )),
425
+ mandatoryTopics: false );
401
426
checkComposeBoxHintTexts (tester,
402
427
contentHintText: 'Message #${channel .name } > topic' );
403
428
});
404
429
430
+ testWidgets ('to TopicNarrow with empty topic' , (tester) async {
431
+ await prepare (tester,
432
+ narrow: TopicNarrow (channel.streamId, TopicName ('' )),
433
+ mandatoryTopics: false );
434
+ checkComposeBoxHintTexts (tester, contentHintText:
435
+ 'Message #${channel .name } > ${eg .defaultRealmEmptyTopicDisplayName }' );
436
+ }, skip: true ); // null topic names soon to be enabled
437
+
405
438
testWidgets ('to DmNarrow with self' , (tester) async {
406
439
await prepare (tester, narrow: DmNarrow .withUser (
407
440
eg.selfUser.userId, selfUserId: eg.selfUser.userId));
0 commit comments