@@ -716,6 +716,7 @@ void main() {
716
716
Future <void > setupAndTapSend (WidgetTester tester, {
717
717
required String topicInputText,
718
718
required bool mandatoryTopics,
719
+ int ? zulipFeatureLevel,
719
720
}) async {
720
721
TypingNotifier .debugEnable = false ;
721
722
addTearDown (TypingNotifier .debugReset);
@@ -724,7 +725,8 @@ void main() {
724
725
final narrow = ChannelNarrow (channel.streamId);
725
726
await prepareComposeBox (tester,
726
727
narrow: narrow, streams: [channel],
727
- mandatoryTopics: mandatoryTopics);
728
+ mandatoryTopics: mandatoryTopics,
729
+ zulipFeatureLevel: zulipFeatureLevel);
728
730
729
731
await enterTopic (tester, narrow: narrow, topic: topicInputText);
730
732
await tester.enterText (contentInputFinder, 'test content' );
@@ -739,10 +741,21 @@ void main() {
739
741
expectedMessage: 'Topics are required in this organization.' );
740
742
}
741
743
742
- testWidgets ('empty topic -> "(no topic)" ' , (tester) async {
744
+ testWidgets ('empty topic -> empty topic' , (tester) async {
743
745
await setupAndTapSend (tester,
744
746
topicInputText: '' ,
745
747
mandatoryTopics: false );
748
+ check (connection.lastRequest).isA< http.Request > ()
749
+ ..method.equals ('POST' )
750
+ ..url.path.equals ('/api/v1/messages' )
751
+ ..bodyFields['topic' ].equals ('' );
752
+ }, skip: true ); // null topic names soon to be enabled
753
+
754
+ testWidgets ('legacy: empty topic -> "(no topic)"' , (tester) async {
755
+ await setupAndTapSend (tester,
756
+ topicInputText: '' ,
757
+ mandatoryTopics: false ,
758
+ zulipFeatureLevel: 333 );
746
759
check (connection.lastRequest).isA< http.Request > ()
747
760
..method.equals ('POST' )
748
761
..url.path.equals ('/api/v1/messages' )
@@ -756,12 +769,27 @@ void main() {
756
769
checkMessageNotSent (tester);
757
770
});
758
771
772
+ testWidgets ('if topics are mandatory, reject `realmEmptyTopicDisplayName`' , (tester) async {
773
+ await setupAndTapSend (tester,
774
+ topicInputText: eg.defaultRealmEmptyTopicDisplayName,
775
+ mandatoryTopics: true );
776
+ checkMessageNotSent (tester);
777
+ }, skip: true ); // null topic names soon to be enabled
778
+
759
779
testWidgets ('if topics are mandatory, reject "(no topic)"' , (tester) async {
760
780
await setupAndTapSend (tester,
761
781
topicInputText: '(no topic)' ,
762
782
mandatoryTopics: true );
763
783
checkMessageNotSent (tester);
764
784
});
785
+
786
+ testWidgets ('legacy: if topics are mandatory, reject "(no topic)"' , (tester) async {
787
+ await setupAndTapSend (tester,
788
+ topicInputText: '(no topic)' ,
789
+ mandatoryTopics: true ,
790
+ zulipFeatureLevel: 333 );
791
+ checkMessageNotSent (tester);
792
+ });
765
793
});
766
794
767
795
group ('uploads' , () {
0 commit comments