@@ -673,6 +673,7 @@ void main() {
673
673
Future <void > setupAndTapSend (WidgetTester tester, {
674
674
required String topicInputText,
675
675
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,8 +698,24 @@ 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 -> general chat ' , (tester) async {
700
702
await setupAndTapSend (tester, topicInputText: '' );
703
+ check (connection.lastRequest).isA< http.Request > ()
704
+ ..method.equals ('POST' )
705
+ ..url.path.equals ('/api/v1/messages' )
706
+ ..bodyFields.deepEquals ({
707
+ 'type' : 'stream' ,
708
+ 'to' : channel.streamId.toString (),
709
+ 'topic' : '' ,
710
+ 'content' : 'test content' ,
711
+ 'read_by_sender' : 'true' ,
712
+ });
713
+ }, skip: true ); // null topic names soon to be enabled
714
+
715
+ testWidgets ('legacy: empty topic -> (no topic)' , (tester) async {
716
+ await setupAndTapSend (tester,
717
+ topicInputText: '' ,
718
+ zulipFeatureLevel: 333 );
701
719
check (connection.lastRequest).isA< http.Request > ()
702
720
..method.equals ('POST' )
703
721
..url.path.equals ('/api/v1/messages' )
@@ -717,12 +735,27 @@ void main() {
717
735
checkMessageNotSent (tester);
718
736
});
719
737
738
+ testWidgets ('if topics are mandatory, reject `realmEmptyTopicDisplayName`' , (tester) async {
739
+ await setupAndTapSend (tester,
740
+ topicInputText: eg.defaultRealmEmptyTopicDisplayName,
741
+ mandatoryTopics: true );
742
+ checkMessageNotSent (tester);
743
+ }, skip: true ); // null topic names soon to be enabled
744
+
720
745
testWidgets ('if topics are mandatory, reject (no topic)' , (tester) async {
721
746
await setupAndTapSend (tester,
722
747
topicInputText: '(no topic)' ,
723
748
mandatoryTopics: true );
724
749
checkMessageNotSent (tester);
725
750
});
751
+
752
+ testWidgets ('legacy: if topics are mandatory, reject (no topic)' , (tester) async {
753
+ await setupAndTapSend (tester,
754
+ topicInputText: '(no topic)' ,
755
+ mandatoryTopics: true ,
756
+ zulipFeatureLevel: 333 );
757
+ checkMessageNotSent (tester);
758
+ });
726
759
});
727
760
728
761
group ('uploads' , () {
0 commit comments