Exemple #1
0
 def test_form_action_default(self):
     mockrequest = mock.MagicMock()
     mockrequest.get_full_path.return_value = '/form/action'
     selector = htmls.S(
         target_renderer.Target(form=forms.Form()).render(
             request=mockrequest))
     self.assertEqual('/form/action', selector.one('form')['action'])
Exemple #2
0
 def test_submit_button_text_default(self):
     selector = htmls.S(
         target_renderer.Target(form=forms.Form()).render(
             request=mock.MagicMock()))
     self.assertEqual(
         'Submit selection',
         selector.one('button[type="submit"]').alltext_normalized)
Exemple #3
0
 def test_with_items_title_default(self):
     selector = htmls.S(
         target_renderer.Target(form=forms.Form()).render(
             request=mock.MagicMock()))
     self.assertEqual(
         'Selected items',
         selector.one('.cradmin-legacy-multiselect2-target-title').
         alltext_normalized)
Exemple #4
0
 def test_submit_button_text_custom_parameter(self):
     selector = htmls.S(
         target_renderer.Target(
             submit_button_text='Perform',
             form=forms.Form()).render(request=mock.MagicMock()))
     self.assertEqual(
         'Perform',
         selector.one('button[type="submit"]').alltext_normalized)
Exemple #5
0
 def test_with_items_title_custom_parameter(self):
     selector = htmls.S(
         target_renderer.Target(
             with_items_title='Test title',
             form=forms.Form()).render(request=mock.MagicMock()))
     self.assertEqual(
         'Test title',
         selector.one('.cradmin-legacy-multiselect2-target-title').
         alltext_normalized)
Exemple #6
0
 def test_without_items_text_default(self):
     selector = htmls.S(
         target_renderer.Target(form=forms.Form()).render(
             request=mock.MagicMock()))
     self.assertEqual(
         '',
         selector.one(
             '.cradmin-legacy-multiselect2-target-without-items-content').
         alltext_normalized)
Exemple #7
0
 def test_without_items_text_custom_parameter(self):
     selector = htmls.S(
         target_renderer.Target(
             without_items_text='Please make a selection',
             form=forms.Form()).render(request=mock.MagicMock()))
     self.assertEqual(
         'Please make a selection',
         selector.one(
             '.cradmin-legacy-multiselect2-target-without-items-content').
         alltext_normalized)
Exemple #8
0
 def test_dom_id_default(self):
     selector = htmls.S(
         target_renderer.Target(form=forms.Form()).render(
             request=mock.MagicMock()))
     self.assertEqual('cradmin_legacy_multiselect2_select_target',
                      selector.one('form')['id'])
Exemple #9
0
 def test_form_action_custom_parameter(self):
     selector = htmls.S(
         target_renderer.Target(
             form_action='/some/view',
             form=forms.Form()).render(request=mock.MagicMock()))
     self.assertEqual('/some/view', selector.one('form')['action'])
Exemple #10
0
 def test_dom_id_custom(self):
     selector = htmls.S(
         target_renderer.Target(
             dom_id='customid',
             form=forms.Form()).render(request=mock.MagicMock()))
     self.assertEqual('customid', selector.one('form')['id'])