@@ -690,6 +690,7 @@ void main() {
690
690
Future <void > setupAndTapSend (WidgetTester tester, {
691
691
required String topicInputText,
692
692
required bool mandatoryTopics,
693
+ int ? zulipFeatureLevel,
693
694
}) async {
694
695
TypingNotifier .debugEnable = false ;
695
696
addTearDown (TypingNotifier .debugReset);
@@ -698,7 +699,8 @@ void main() {
698
699
final narrow = ChannelNarrow (channel.streamId);
699
700
await prepareComposeBox (tester,
700
701
narrow: narrow, streams: [channel],
701
- mandatoryTopics: mandatoryTopics);
702
+ mandatoryTopics: mandatoryTopics,
703
+ zulipFeatureLevel: zulipFeatureLevel);
702
704
703
705
await enterTopic (tester, narrow: narrow, topic: topicInputText);
704
706
await tester.enterText (contentInputFinder, 'test content' );
@@ -713,10 +715,21 @@ void main() {
713
715
expectedMessage: 'Topics are required in this organization.' );
714
716
}
715
717
716
- testWidgets ('empty topic -> "(no topic)" ' , (tester) async {
718
+ testWidgets ('empty topic -> empty topic' , (tester) async {
717
719
await setupAndTapSend (tester,
718
720
topicInputText: '' ,
719
721
mandatoryTopics: false );
722
+ check (connection.lastRequest).isA< http.Request > ()
723
+ ..method.equals ('POST' )
724
+ ..url.path.equals ('/api/v1/messages' )
725
+ ..bodyFields['topic' ].equals ('' );
726
+ }, skip: true ); // null topic names soon to be enabled
727
+
728
+ testWidgets ('legacy: empty topic -> "(no topic)"' , (tester) async {
729
+ await setupAndTapSend (tester,
730
+ topicInputText: '' ,
731
+ mandatoryTopics: false ,
732
+ zulipFeatureLevel: 333 );
720
733
check (connection.lastRequest).isA< http.Request > ()
721
734
..method.equals ('POST' )
722
735
..url.path.equals ('/api/v1/messages' )
@@ -730,12 +743,27 @@ void main() {
730
743
checkMessageNotSent (tester);
731
744
});
732
745
746
+ testWidgets ('if topics are mandatory, reject `realmEmptyTopicDisplayName`' , (tester) async {
747
+ await setupAndTapSend (tester,
748
+ topicInputText: eg.defaultRealmEmptyTopicDisplayName,
749
+ mandatoryTopics: true );
750
+ checkMessageNotSent (tester);
751
+ }, skip: true ); // null topic names soon to be enabled
752
+
733
753
testWidgets ('if topics are mandatory, reject "(no topic)"' , (tester) async {
734
754
await setupAndTapSend (tester,
735
755
topicInputText: '(no topic)' ,
736
756
mandatoryTopics: true );
737
757
checkMessageNotSent (tester);
738
758
});
759
+
760
+ testWidgets ('legacy: if topics are mandatory, reject "(no topic)"' , (tester) async {
761
+ await setupAndTapSend (tester,
762
+ topicInputText: '(no topic)' ,
763
+ mandatoryTopics: true ,
764
+ zulipFeatureLevel: 333 );
765
+ checkMessageNotSent (tester);
766
+ });
739
767
});
740
768
741
769
group ('uploads' , () {
0 commit comments