Esempio n. 1
0
 def test_can_render_a_single_disabled_option(self):
     # Setup
     widget = SelectWithDisabled()
     # Run
     rendered = widget.render_option([], '1', {'label': 'Test forum', 'disabled': True})
     # Check
     assert rendered == '<option value="1" disabled="disabled">Test forum</option>'
Esempio n. 2
0
 def test_can_render_a_single_option_that_is_selected(self):
     # Setup
     widget = SelectWithDisabled()
     # Run
     rendered = widget.render_option(['1', ], '1', 'Test forum')
     # Check
     assert rendered == '<option value="1" selected="selected">Test forum</option>'
Esempio n. 3
0
 def test_can_render_a_single_option(self):
     # Setup
     widget = SelectWithDisabled()
     # Run
     rendered = widget.render_option([], '1', 'Test forum')
     # Check
     assert rendered == '<option value="1">Test forum</option>'
Esempio n. 4
0
 def test_can_prepare_a_single_option(self):
     # Setup
     widget = SelectWithDisabled()
     # Run
     option = widget.create_option('test', '1', 'Test forum', False, 0)
     # Check
     assert option['name'] == 'test'
     assert option['label'] == 'Test forum'
     assert option['index'] == '0'
Esempio n. 5
0
 def test_can_render_a_single_disabled_option(self):
     # Setup
     widget = SelectWithDisabled()
     # Run
     rendered = widget.render_option([], '1', {
         'label': 'Test forum',
         'disabled': True
     })
     # Check
     assert rendered == '<option value="1" disabled="disabled">Test forum</option>'
Esempio n. 6
0
 def test_can_prepare_a_single_option_that_is_selected(self):
     # Setup
     widget = SelectWithDisabled()
     # Run
     option = widget.create_option('test', '1', 'Test forum', True, 0)
     # Check
     assert option['name'] == 'test'
     assert option['label'] == 'Test forum'
     assert option['index'] == '0'
     assert option['attrs'] == {'selected': True}