@@ -109,3 +109,46 @@ def test_auto_submit_button_does_not_appear_when_button_exists(self):
109109
110110 self .assertEqual (response .status_code , 200 )
111111 self .assertEqual (response .content .decode ().count ('type="submit"' ), 1 )
112+
113+ def test_auto_submit_button_does_not_appear_with_indirect_button (self ):
114+ form = add_plugin (
115+ placeholder = self .placeholder ,
116+ plugin_type = cms_plugins .FormPlugin .__name__ ,
117+ language = self .language ,
118+ form_selection = "" ,
119+ form_name = "test-form" ,
120+ )
121+ parent_field = add_plugin (
122+ placeholder = self .placeholder ,
123+ plugin_type = cms_plugins .CharFieldPlugin .__name__ ,
124+ target = form ,
125+ language = self .language ,
126+ config = dict (
127+ field_name = "parent_field" ,
128+ ),
129+ )
130+ container_field = add_plugin (
131+ placeholder = self .placeholder ,
132+ plugin_type = cms_plugins .CharFieldPlugin .__name__ ,
133+ target = parent_field , # Indirect child of form
134+ language = self .language ,
135+ config = dict (
136+ field_name = "container_field" ,
137+ ),
138+ )
139+ add_plugin (
140+ placeholder = self .placeholder ,
141+ plugin_type = cms_plugins .SubmitPlugin .__name__ ,
142+ target = container_field ,
143+ language = self .language ,
144+ config = dict (
145+ submit_cta = "Submit Form" ,
146+ ),
147+ )
148+
149+ self .publish (self .page , self .language )
150+ with self .login_user_context (self .superuser ):
151+ response = self .client .get (self .request_url )
152+
153+ self .assertEqual (response .status_code , 200 )
154+ self .assertEqual (response .content .decode ().count ('type="submit"' ), 1 )
0 commit comments