95 |
95 |
end
|
96 |
96 |
end
|
97 |
97 |
|
|
98 |
def test_edit_tag_should_include_blank_option_on_new_record
|
|
99 |
field = IssueCustomField.new(:field_format => 'list', :possible_values => ['Foo', 'Bar'], :is_required => true,
|
|
100 |
:multiple => false)
|
|
101 |
value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new)
|
|
102 |
|
|
103 |
tag = field.format.edit_tag(self, 'id', 'name', value)
|
|
104 |
assert_select_in tag, 'select' do
|
|
105 |
assert_select 'option', 3
|
|
106 |
assert_select 'option[value=""]'
|
|
107 |
assert_select 'option[value=Foo]', :text => 'Foo'
|
|
108 |
assert_select 'option[value=Bar]', :text => 'Bar'
|
|
109 |
end
|
|
110 |
end
|
|
111 |
|
|
112 |
def test_edit_tag_should_not_include_blank_option_on_new_record_with_default_value
|
|
113 |
field = IssueCustomField.new(:field_format => 'list', :possible_values => ['Foo', 'Bar'], :is_required => true,
|
|
114 |
:multiple => false, :default_value => 'Bar')
|
|
115 |
value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new)
|
|
116 |
|
|
117 |
tag = field.format.edit_tag(self, 'id', 'name', value)
|
|
118 |
assert_select_in tag, 'select' do
|
|
119 |
assert_select 'option', 2
|
|
120 |
assert_select 'option[value=Foo]', :text => 'Foo'
|
|
121 |
assert_select 'option[value=Bar]', :text => 'Bar'
|
|
122 |
end
|
|
123 |
end
|
|
124 |
|
|
125 |
def test_edit_tag_should_include_blank_option_on_persisted_record
|
|
126 |
field = IssueCustomField.new(:field_format => 'list', :possible_values => ['Foo', 'Bar'], :is_required => true,
|
|
127 |
:multiple => false, :default_value => 'Bar')
|
|
128 |
value = CustomFieldValue.new(:custom_field => field, :customized => Issue.generate!)
|
|
129 |
|
|
130 |
tag = field.format.edit_tag(self, 'id', 'name', value)
|
|
131 |
assert_select_in tag, 'select' do
|
|
132 |
assert_select 'option', 3
|
|
133 |
assert_select 'option[value=""]'
|
|
134 |
assert_select 'option[value=Foo]', :text => 'Foo'
|
|
135 |
assert_select 'option[value=Bar]', :text => 'Bar'
|
|
136 |
end
|
|
137 |
end
|
|
138 |
|
98 |
139 |
def test_edit_tag_with_check_box_style_should_contain_possible_values
|
99 |
140 |
field = IssueCustomField.new(:field_format => 'list', :possible_values => ['Foo', 'Bar'], :is_required => false,
|
100 |
141 |
:edit_tag_style => 'check_box')
|