Mercurial > hg > soundsoftware-site
comparison .svn/pristine/54/543b1e9663af0e223820d33978bf2f524e861003.svn-base @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
1 # Redmine - project management software | |
2 # Copyright (C) 2006-2014 Jean-Philippe Lang | |
3 # | |
4 # This program is free software; you can redistribute it and/or | |
5 # modify it under the terms of the GNU General Public License | |
6 # as published by the Free Software Foundation; either version 2 | |
7 # of the License, or (at your option) any later version. | |
8 # | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU General Public License for more details. | |
13 # | |
14 # You should have received a copy of the GNU General Public License | |
15 # along with this program; if not, write to the Free Software | |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | |
18 require File.expand_path('../../../../../test_helper', __FILE__) | |
19 require 'redmine/field_format' | |
20 | |
21 class Redmine::BoolFieldFormatTest < ActionView::TestCase | |
22 include ApplicationHelper | |
23 include Redmine::I18n | |
24 | |
25 def setup | |
26 set_language_if_valid 'en' | |
27 end | |
28 | |
29 def test_check_box_style_should_render_edit_tag_as_check_box | |
30 field = IssueCustomField.new(:field_format => 'bool', :is_required => false, :edit_tag_style => 'check_box') | |
31 value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new) | |
32 | |
33 tag = field.format.edit_tag(self, 'abc', 'xyz', value) | |
34 assert_select_in tag, 'input[name=xyz]', 2 | |
35 assert_select_in tag, 'input[id=abc]', 1 | |
36 assert_select_in tag, 'input[type=hidden][value=0]' | |
37 assert_select_in tag, 'input[type=checkbox][value=1]' | |
38 end | |
39 | |
40 def test_check_box_should_be_checked_when_value_is_set | |
41 field = IssueCustomField.new(:field_format => 'bool', :is_required => false, :edit_tag_style => 'check_box') | |
42 value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new, :value => '1') | |
43 | |
44 tag = field.format.edit_tag(self, 'abc', 'xyz', value) | |
45 assert_select_in tag, 'input[type=checkbox][value=1][checked=checked]' | |
46 end | |
47 | |
48 def test_radio_style_should_render_edit_tag_as_radio_buttons | |
49 field = IssueCustomField.new(:field_format => 'bool', :is_required => false, :edit_tag_style => 'radio') | |
50 value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new) | |
51 | |
52 tag = field.format.edit_tag(self, 'abc', 'xyz', value) | |
53 assert_select_in tag, 'input[type=radio][name=xyz]', 3 | |
54 end | |
55 | |
56 def test_default_style_should_render_edit_tag_as_select | |
57 field = IssueCustomField.new(:field_format => 'bool', :is_required => false) | |
58 value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new) | |
59 | |
60 tag = field.format.edit_tag(self, 'abc', 'xyz', value) | |
61 assert_select_in tag, 'select[name=xyz]', 1 | |
62 end | |
63 end |