@@ -673,6 +673,7 @@ void main() {
673
673
Future <void > setupAndTapSend (WidgetTester tester, {
674
674
required String topicInputText,
675
675
required bool mandatoryTopics,
676
+ int ? zulipFeatureLevel,
676
677
}) async {
677
678
TypingNotifier .debugEnable = false ;
678
679
addTearDown (TypingNotifier .debugReset);
@@ -681,7 +682,8 @@ void main() {
681
682
final narrow = ChannelNarrow (channel.streamId);
682
683
await prepareComposeBox (tester,
683
684
narrow: narrow, streams: [channel],
684
- mandatoryTopics: mandatoryTopics);
685
+ mandatoryTopics: mandatoryTopics,
686
+ zulipFeatureLevel: zulipFeatureLevel);
685
687
686
688
await enterTopic (tester, narrow: narrow, topic: topicInputText);
687
689
await tester.enterText (contentInputFinder, 'test content' );
@@ -696,10 +698,21 @@ void main() {
696
698
expectedMessage: 'Topics are required in this organization.' );
697
699
}
698
700
699
- testWidgets ('empty topic -> "(no topic)" ' , (tester) async {
701
+ testWidgets ('empty topic -> empty topic' , (tester) async {
700
702
await setupAndTapSend (tester,
701
703
topicInputText: '' ,
702
704
mandatoryTopics: false );
705
+ check (connection.lastRequest).isA< http.Request > ()
706
+ ..method.equals ('POST' )
707
+ ..url.path.equals ('/api/v1/messages' )
708
+ ..bodyFields['topic' ].equals ('' );
709
+ }, skip: true ); // null topic names soon to be enabled
710
+
711
+ testWidgets ('legacy: empty topic -> "(no topic)"' , (tester) async {
712
+ await setupAndTapSend (tester,
713
+ topicInputText: '' ,
714
+ mandatoryTopics: false ,
715
+ zulipFeatureLevel: 333 );
703
716
check (connection.lastRequest).isA< http.Request > ()
704
717
..method.equals ('POST' )
705
718
..url.path.equals ('/api/v1/messages' )
@@ -713,12 +726,27 @@ void main() {
713
726
checkMessageNotSent (tester);
714
727
});
715
728
729
+ testWidgets ('if topics are mandatory, reject `realmEmptyTopicDisplayName`' , (tester) async {
730
+ await setupAndTapSend (tester,
731
+ topicInputText: eg.defaultRealmEmptyTopicDisplayName,
732
+ mandatoryTopics: true );
733
+ checkMessageNotSent (tester);
734
+ }, skip: true ); // null topic names soon to be enabled
735
+
716
736
testWidgets ('if topics are mandatory, reject "(no topic)"' , (tester) async {
717
737
await setupAndTapSend (tester,
718
738
topicInputText: '(no topic)' ,
719
739
mandatoryTopics: true );
720
740
checkMessageNotSent (tester);
721
741
});
742
+
743
+ testWidgets ('legacy: if topics are mandatory, reject "(no topic)"' , (tester) async {
744
+ await setupAndTapSend (tester,
745
+ topicInputText: '(no topic)' ,
746
+ mandatoryTopics: true ,
747
+ zulipFeatureLevel: 333 );
748
+ checkMessageNotSent (tester);
749
+ });
722
750
});
723
751
724
752
group ('uploads' , () {
0 commit comments