@@ -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
@@ -317,11 +320,15 @@ void main() {
317
320
318
321
Future <void > prepare (WidgetTester tester, {
319
322
required Narrow narrow,
323
+ bool ? mandatoryTopics,
324
+ int ? zulipFeatureLevel,
320
325
}) async {
321
326
await prepareComposeBox (tester,
322
327
narrow: narrow,
323
328
otherUsers: [eg.otherUser, eg.thirdUser],
324
- streams: [channel]);
329
+ streams: [channel],
330
+ mandatoryTopics: mandatoryTopics,
331
+ zulipFeatureLevel: zulipFeatureLevel);
325
332
}
326
333
327
334
void checkComposeBoxHintTexts (WidgetTester tester, {
@@ -340,6 +347,22 @@ void main() {
340
347
341
348
testWidgets ('to ChannelNarrow without topic' , (tester) async {
342
349
await prepare (tester, narrow: ChannelNarrow (channel.streamId));
350
+ checkComposeBoxHintTexts (tester,
351
+ topicHintText: eg.defaultRealmEmptyTopicDisplayName,
352
+ contentHintText: 'Message #${channel .name } > ${eg .defaultRealmEmptyTopicDisplayName }' );
353
+ }, skip: true ); // null topic names soon to be enabled
354
+
355
+ testWidgets ('to ChannelNarrow without topic; mandatory topics' , (tester) async {
356
+ await prepare (tester, narrow: ChannelNarrow (channel.streamId),
357
+ mandatoryTopics: true );
358
+ checkComposeBoxHintTexts (tester,
359
+ topicHintText: 'Topic' ,
360
+ contentHintText: 'Message #${channel .name } > ${eg .defaultRealmEmptyTopicDisplayName }' );
361
+ }, skip: true ); // null topic names soon to be enabled
362
+
363
+ testWidgets ('legacy: to ChannelNarrow without topic' , (tester) async {
364
+ await prepare (tester, narrow: ChannelNarrow (channel.streamId),
365
+ zulipFeatureLevel: 333 );
343
366
checkComposeBoxHintTexts (tester,
344
367
topicHintText: 'Topic' ,
345
368
contentHintText: 'Message #${channel .name } > (no topic)' );
@@ -351,7 +374,7 @@ void main() {
351
374
await enterTopic (tester, narrow: narrow, topic: 'new topic' );
352
375
await tester.pump ();
353
376
checkComposeBoxHintTexts (tester,
354
- topicHintText: 'Topic' ,
377
+ topicHintText: eg.defaultRealmEmptyTopicDisplayName ,
355
378
contentHintText: 'Message #${channel .name } > new topic' );
356
379
});
357
380
@@ -362,6 +385,13 @@ void main() {
362
385
contentHintText: 'Message #${channel .name } > topic' );
363
386
});
364
387
388
+ testWidgets ('to TopicNarrow with empty topic' , (tester) async {
389
+ await prepare (tester,
390
+ narrow: TopicNarrow (channel.streamId, TopicName ('' )));
391
+ checkComposeBoxHintTexts (tester, contentHintText:
392
+ 'Message #${channel .name } > ${eg .defaultRealmEmptyTopicDisplayName }' );
393
+ }, skip: true ); // null topic names soon to be enabled
394
+
365
395
testWidgets ('to DmNarrow with self' , (tester) async {
366
396
await prepare (tester, narrow: DmNarrow .withUser (
367
397
eg.selfUser.userId, selfUserId: eg.selfUser.userId));
0 commit comments