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