actionpack 1.9.1 → 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- data/CHANGELOG +237 -0
- data/README +12 -12
- data/lib/action_controller.rb +17 -12
- data/lib/action_controller/assertions.rb +119 -67
- data/lib/action_controller/base.rb +184 -102
- data/lib/action_controller/benchmarking.rb +35 -6
- data/lib/action_controller/caching.rb +115 -58
- data/lib/action_controller/cgi_ext/cgi_methods.rb +54 -21
- data/lib/action_controller/cgi_ext/cookie_performance_fix.rb +39 -35
- data/lib/action_controller/cgi_ext/raw_post_data_fix.rb +34 -21
- data/lib/action_controller/cgi_process.rb +23 -20
- data/lib/action_controller/components.rb +11 -2
- data/lib/action_controller/dependencies.rb +0 -5
- data/lib/action_controller/deprecated_redirects.rb +17 -0
- data/lib/action_controller/filters.rb +13 -9
- data/lib/action_controller/flash.rb +7 -7
- data/lib/action_controller/helpers.rb +1 -14
- data/lib/action_controller/layout.rb +40 -29
- data/lib/action_controller/macros/auto_complete.rb +52 -0
- data/lib/action_controller/macros/in_place_editing.rb +32 -0
- data/lib/action_controller/pagination.rb +44 -28
- data/lib/action_controller/request.rb +54 -40
- data/lib/action_controller/rescue.rb +8 -6
- data/lib/action_controller/routing.rb +77 -28
- data/lib/action_controller/scaffolding.rb +10 -14
- data/lib/action_controller/session/active_record_store.rb +36 -7
- data/lib/action_controller/session_management.rb +126 -0
- data/lib/action_controller/streaming.rb +14 -5
- data/lib/action_controller/templates/rescues/_request_and_response.rhtml +1 -1
- data/lib/action_controller/templates/rescues/_trace.rhtml +24 -0
- data/lib/action_controller/templates/rescues/diagnostics.rhtml +2 -13
- data/lib/action_controller/templates/rescues/template_error.rhtml +4 -2
- data/lib/action_controller/templates/scaffolds/list.rhtml +1 -1
- data/lib/action_controller/test_process.rb +35 -17
- data/lib/action_controller/upload_progress.rb +52 -0
- data/lib/action_controller/url_rewriter.rb +21 -16
- data/lib/action_controller/vendor/html-scanner/html/document.rb +2 -2
- data/lib/action_controller/vendor/html-scanner/html/node.rb +30 -3
- data/lib/action_pack/version.rb +9 -0
- data/lib/action_view.rb +1 -1
- data/lib/action_view/base.rb +204 -60
- data/lib/action_view/compiled_templates.rb +70 -0
- data/lib/action_view/helpers/active_record_helper.rb +7 -3
- data/lib/action_view/helpers/asset_tag_helper.rb +22 -12
- data/lib/action_view/helpers/capture_helper.rb +2 -10
- data/lib/action_view/helpers/date_helper.rb +21 -13
- data/lib/action_view/helpers/form_helper.rb +14 -10
- data/lib/action_view/helpers/form_options_helper.rb +4 -4
- data/lib/action_view/helpers/form_tag_helper.rb +59 -25
- data/lib/action_view/helpers/java_script_macros_helper.rb +188 -0
- data/lib/action_view/helpers/javascript_helper.rb +68 -133
- data/lib/action_view/helpers/javascripts/controls.js +427 -165
- data/lib/action_view/helpers/javascripts/dragdrop.js +256 -277
- data/lib/action_view/helpers/javascripts/effects.js +766 -277
- data/lib/action_view/helpers/javascripts/prototype.js +906 -218
- data/lib/action_view/helpers/javascripts/slider.js +258 -0
- data/lib/action_view/helpers/number_helper.rb +4 -3
- data/lib/action_view/helpers/pagination_helper.rb +42 -27
- data/lib/action_view/helpers/tag_helper.rb +25 -11
- data/lib/action_view/helpers/text_helper.rb +119 -13
- data/lib/action_view/helpers/upload_progress_helper.rb +2 -2
- data/lib/action_view/helpers/url_helper.rb +68 -21
- data/lib/action_view/partials.rb +17 -6
- data/lib/action_view/template_error.rb +19 -24
- data/rakefile +4 -3
- data/test/abstract_unit.rb +2 -1
- data/test/controller/action_pack_assertions_test.rb +62 -2
- data/test/controller/active_record_assertions_test.rb +5 -6
- data/test/controller/active_record_store_test.rb +23 -1
- data/test/controller/addresses_render_test.rb +4 -0
- data/test/controller/{base_tests.rb → base_test.rb} +4 -3
- data/test/controller/benchmark_test.rb +36 -0
- data/test/controller/caching_filestore.rb +22 -40
- data/test/controller/capture_test.rb +10 -1
- data/test/controller/cgi_test.rb +145 -23
- data/test/controller/components_test.rb +50 -0
- data/test/controller/custom_handler_test.rb +3 -3
- data/test/controller/fake_controllers.rb +24 -0
- data/test/controller/filters_test.rb +6 -6
- data/test/controller/flash_test.rb +6 -6
- data/test/controller/fragment_store_setting_test.rb +45 -0
- data/test/controller/helper_test.rb +1 -3
- data/test/controller/new_render_test.rb +119 -7
- data/test/controller/redirect_test.rb +11 -1
- data/test/controller/render_test.rb +34 -1
- data/test/controller/request_test.rb +14 -5
- data/test/controller/routing_test.rb +238 -42
- data/test/controller/send_file_test.rb +11 -10
- data/test/controller/session_management_test.rb +94 -0
- data/test/controller/test_test.rb +194 -5
- data/test/controller/url_rewriter_test.rb +46 -0
- data/test/fixtures/layouts/talk_from_action.rhtml +2 -0
- data/test/fixtures/layouts/yield.rhtml +2 -0
- data/test/fixtures/multipart/binary_file +0 -0
- data/test/fixtures/multipart/large_text_file +10 -0
- data/test/fixtures/multipart/mixed_files +0 -0
- data/test/fixtures/multipart/single_parameter +5 -0
- data/test/fixtures/multipart/text_file +10 -0
- data/test/fixtures/test/_customer_greeting.rhtml +1 -0
- data/test/fixtures/test/_hash_object.rhtml +1 -0
- data/test/fixtures/test/_person.rhtml +2 -0
- data/test/fixtures/test/action_talk_to_layout.rhtml +2 -0
- data/test/fixtures/test/content_for.rhtml +2 -0
- data/test/fixtures/test/potential_conflicts.rhtml +4 -0
- data/test/template/active_record_helper_test.rb +15 -8
- data/test/template/asset_tag_helper_test.rb +40 -16
- data/test/template/compiled_templates_tests.rb +63 -0
- data/test/template/date_helper_test.rb +80 -4
- data/test/template/form_helper_test.rb +48 -42
- data/test/template/form_options_helper_test.rb +40 -40
- data/test/template/form_tag_helper_test.rb +21 -15
- data/test/template/java_script_macros_helper_test.rb +56 -0
- data/test/template/javascript_helper_test.rb +70 -47
- data/test/template/number_helper_test.rb +2 -0
- data/test/template/tag_helper_test.rb +9 -0
- data/test/template/text_helper_test.rb +146 -1
- data/test/template/upload_progress_helper_testx.rb +11 -147
- data/test/template/url_helper_test.rb +90 -22
- data/test/testing_sandbox.rb +26 -0
- metadata +37 -7
- data/lib/action_controller/auto_complete.rb +0 -47
- data/lib/action_controller/deprecated_renders_and_redirects.rb +0 -76
- data/lib/action_controller/session.rb +0 -14
@@ -6,14 +6,14 @@ require File.dirname(__FILE__) + '/../../../activesupport/lib/active_support/cor
|
|
6
6
|
class FormHelperTest < Test::Unit::TestCase
|
7
7
|
include ActionView::Helpers::FormHelper
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
silence_warnings do
|
10
|
+
Post = Struct.new("Post", :title, :author_name, :body, :secret, :written_on, :cost)
|
11
|
+
Post.class_eval do
|
12
|
+
alias_method :title_before_type_cast, :title unless respond_to?(:title_before_type_cast)
|
13
|
+
alias_method :body_before_type_cast, :body unless respond_to?(:body_before_type_cast)
|
14
|
+
alias_method :author_name_before_type_cast, :author_name unless respond_to?(:author_name_before_type_cast)
|
15
|
+
end
|
15
16
|
end
|
16
|
-
$VERBOSE = old_verbose
|
17
17
|
|
18
18
|
def setup
|
19
19
|
@post = Post.new
|
@@ -30,52 +30,52 @@ class FormHelperTest < Test::Unit::TestCase
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_text_field
|
33
|
-
|
33
|
+
assert_dom_equal(
|
34
34
|
'<input id="post_title" name="post[title]" size="30" type="text" value="Hello World" />', text_field("post", "title")
|
35
35
|
)
|
36
|
-
|
36
|
+
assert_dom_equal(
|
37
37
|
'<input id="post_title" name="post[title]" size="30" type="password" value="Hello World" />', password_field("post", "title")
|
38
38
|
)
|
39
|
-
|
39
|
+
assert_dom_equal(
|
40
40
|
'<input id="person_name" name="person[name]" size="30" type="password" />', password_field("person", "name")
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_text_field_with_escapes
|
45
45
|
@post.title = "<b>Hello World</b>"
|
46
|
-
|
46
|
+
assert_dom_equal(
|
47
47
|
'<input id="post_title" name="post[title]" size="30" type="text" value="<b>Hello World</b>" />', text_field("post", "title")
|
48
48
|
)
|
49
49
|
end
|
50
50
|
|
51
51
|
def test_text_field_with_options
|
52
52
|
expected = '<input id="post_title" name="post[title]" size="35" type="text" value="Hello World" />'
|
53
|
-
|
54
|
-
|
53
|
+
assert_dom_equal expected, text_field("post", "title", "size" => 35)
|
54
|
+
assert_dom_equal expected, text_field("post", "title", :size => 35)
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_text_field_assuming_size
|
58
58
|
expected = '<input id="post_title" maxlength="35" name="post[title]" size="35" type="text" value="Hello World" />'
|
59
|
-
|
60
|
-
|
59
|
+
assert_dom_equal expected, text_field("post", "title", "maxlength" => 35)
|
60
|
+
assert_dom_equal expected, text_field("post", "title", :maxlength => 35)
|
61
61
|
end
|
62
62
|
|
63
63
|
def test_check_box
|
64
|
-
|
64
|
+
assert_dom_equal(
|
65
65
|
'<input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" /><input name="post[secret]" type="hidden" value="0" />',
|
66
66
|
check_box("post", "secret")
|
67
67
|
)
|
68
68
|
@post.secret = 0
|
69
|
-
|
69
|
+
assert_dom_equal(
|
70
70
|
'<input id="post_secret" name="post[secret]" type="checkbox" value="1" /><input name="post[secret]" type="hidden" value="0" />',
|
71
71
|
check_box("post", "secret")
|
72
72
|
)
|
73
|
-
|
73
|
+
assert_dom_equal(
|
74
74
|
'<input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" /><input name="post[secret]" type="hidden" value="0" />',
|
75
75
|
check_box("post", "secret" ,{"checked"=>"checked"})
|
76
76
|
)
|
77
77
|
@post.secret = true
|
78
|
-
|
78
|
+
assert_dom_equal(
|
79
79
|
'<input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" /><input name="post[secret]" type="hidden" value="0" />',
|
80
80
|
check_box("post", "secret")
|
81
81
|
)
|
@@ -83,23 +83,29 @@ class FormHelperTest < Test::Unit::TestCase
|
|
83
83
|
|
84
84
|
def test_check_box_with_explicit_checked_and_unchecked_values
|
85
85
|
@post.secret = "on"
|
86
|
-
|
86
|
+
assert_dom_equal(
|
87
87
|
'<input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="on" /><input name="post[secret]" type="hidden" value="off" />',
|
88
88
|
check_box("post", "secret", {}, "on", "off")
|
89
89
|
)
|
90
90
|
end
|
91
91
|
|
92
92
|
def test_radio_button
|
93
|
-
|
93
|
+
assert_dom_equal('<input checked="checked" id="post_title_hello_world" name="post[title]" type="radio" value="Hello World" />',
|
94
94
|
radio_button("post", "title", "Hello World")
|
95
95
|
)
|
96
|
-
|
96
|
+
assert_dom_equal('<input id="post_title_goodbye_world" name="post[title]" type="radio" value="Goodbye World" />',
|
97
97
|
radio_button("post", "title", "Goodbye World")
|
98
98
|
)
|
99
99
|
end
|
100
100
|
|
101
|
+
def test_radio_button_is_checked_with_integers
|
102
|
+
assert_dom_equal('<input checked="checked" id="post_secret_1" name="post[secret]" type="radio" value="1" />',
|
103
|
+
radio_button("post", "secret", "1")
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
101
107
|
def test_text_area
|
102
|
-
|
108
|
+
assert_dom_equal(
|
103
109
|
'<textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
|
104
110
|
text_area("post", "body")
|
105
111
|
)
|
@@ -107,77 +113,77 @@ class FormHelperTest < Test::Unit::TestCase
|
|
107
113
|
|
108
114
|
def test_text_area_with_escapes
|
109
115
|
@post.body = "Back to <i>the</i> hill and over it again!"
|
110
|
-
|
116
|
+
assert_dom_equal(
|
111
117
|
'<textarea cols="40" id="post_body" name="post[body]" rows="20">Back to <i>the</i> hill and over it again!</textarea>',
|
112
118
|
text_area("post", "body")
|
113
119
|
)
|
114
120
|
end
|
115
121
|
|
116
122
|
def test_date_selects
|
117
|
-
|
123
|
+
assert_dom_equal(
|
118
124
|
'<textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
|
119
125
|
text_area("post", "body")
|
120
126
|
)
|
121
127
|
end
|
122
128
|
|
123
129
|
def test_explicit_name
|
124
|
-
|
130
|
+
assert_dom_equal(
|
125
131
|
'<input id="post_title" name="dont guess" size="30" type="text" value="Hello World" />', text_field("post", "title", "name" => "dont guess")
|
126
132
|
)
|
127
|
-
|
133
|
+
assert_dom_equal(
|
128
134
|
'<textarea cols="40" id="post_body" name="really!" rows="20">Back to the hill and over it again!</textarea>',
|
129
135
|
text_area("post", "body", "name" => "really!")
|
130
136
|
)
|
131
|
-
|
137
|
+
assert_dom_equal(
|
132
138
|
'<input checked="checked" id="post_secret" name="i mean it" type="checkbox" value="1" /><input name="i mean it" type="hidden" value="0" />',
|
133
139
|
check_box("post", "secret", "name" => "i mean it")
|
134
140
|
)
|
135
|
-
|
141
|
+
assert_dom_equal text_field("post", "title", "name" => "dont guess"),
|
136
142
|
text_field("post", "title", :name => "dont guess")
|
137
|
-
|
143
|
+
assert_dom_equal text_area("post", "body", "name" => "really!"),
|
138
144
|
text_area("post", "body", :name => "really!")
|
139
|
-
|
145
|
+
assert_dom_equal check_box("post", "secret", "name" => "i mean it"),
|
140
146
|
check_box("post", "secret", :name => "i mean it")
|
141
147
|
end
|
142
148
|
|
143
149
|
def test_explicit_id
|
144
|
-
|
150
|
+
assert_dom_equal(
|
145
151
|
'<input id="dont guess" name="post[title]" size="30" type="text" value="Hello World" />', text_field("post", "title", "id" => "dont guess")
|
146
152
|
)
|
147
|
-
|
153
|
+
assert_dom_equal(
|
148
154
|
'<textarea cols="40" id="really!" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
|
149
155
|
text_area("post", "body", "id" => "really!")
|
150
156
|
)
|
151
|
-
|
157
|
+
assert_dom_equal(
|
152
158
|
'<input checked="checked" id="i mean it" name="post[secret]" type="checkbox" value="1" /><input name="post[secret]" type="hidden" value="0" />',
|
153
159
|
check_box("post", "secret", "id" => "i mean it")
|
154
160
|
)
|
155
|
-
|
161
|
+
assert_dom_equal text_field("post", "title", "id" => "dont guess"),
|
156
162
|
text_field("post", "title", :id => "dont guess")
|
157
|
-
|
163
|
+
assert_dom_equal text_area("post", "body", "id" => "really!"),
|
158
164
|
text_area("post", "body", :id => "really!")
|
159
|
-
|
165
|
+
assert_dom_equal check_box("post", "secret", "id" => "i mean it"),
|
160
166
|
check_box("post", "secret", :id => "i mean it")
|
161
167
|
end
|
162
168
|
|
163
169
|
def test_auto_index
|
164
170
|
pid = @post.id
|
165
|
-
|
171
|
+
assert_dom_equal(
|
166
172
|
"<input id=\"post_#{pid}_title\" name=\"post[#{pid}][title]\" size=\"30\" type=\"text\" value=\"Hello World\" />", text_field("post[]","title")
|
167
173
|
)
|
168
|
-
|
174
|
+
assert_dom_equal(
|
169
175
|
"<textarea cols=\"40\" id=\"post_#{pid}_body\" name=\"post[#{pid}][body]\" rows=\"20\">Back to the hill and over it again!</textarea>",
|
170
176
|
text_area("post[]", "body")
|
171
177
|
)
|
172
|
-
|
178
|
+
assert_dom_equal(
|
173
179
|
"<input checked=\"checked\" id=\"post_#{pid}_secret\" name=\"post[#{pid}][secret]\" type=\"checkbox\" value=\"1\" /><input name=\"post[#{pid}][secret]\" type=\"hidden\" value=\"0\" />",
|
174
180
|
check_box("post[]", "secret")
|
175
181
|
)
|
176
|
-
|
182
|
+
assert_dom_equal(
|
177
183
|
"<input checked=\"checked\" id=\"post_#{pid}_title_hello_world\" name=\"post[#{pid}][title]\" type=\"radio\" value=\"Hello World\" />",
|
178
184
|
radio_button("post[]", "title", "Hello World")
|
179
185
|
)
|
180
|
-
|
186
|
+
assert_dom_equal("<input id=\"post_#{pid}_title_goodbye_world\" name=\"post[#{pid}][title]\" type=\"radio\" value=\"Goodbye World\" />",
|
181
187
|
radio_button("post[]", "title", "Goodbye World")
|
182
188
|
)
|
183
189
|
end
|
@@ -25,12 +25,12 @@ ActionView::Helpers::FormOptionsHelper::TimeZone = MockTimeZone
|
|
25
25
|
class FormOptionsHelperTest < Test::Unit::TestCase
|
26
26
|
include ActionView::Helpers::FormOptionsHelper
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
silence_warnings do
|
29
|
+
Post = Struct.new('Post', :title, :author_name, :body, :secret, :written_on, :category, :origin)
|
30
|
+
Continent = Struct.new('Continent', :continent_name, :countries)
|
31
|
+
Country = Struct.new('Country', :country_id, :country_name)
|
32
|
+
Firm = Struct.new('Firm', :time_zone)
|
33
|
+
end
|
34
34
|
|
35
35
|
def test_collection_options
|
36
36
|
@posts = [
|
@@ -39,7 +39,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
39
39
|
Post.new("Cabe went home", "Cabe", "To a little house", "shh!")
|
40
40
|
]
|
41
41
|
|
42
|
-
|
42
|
+
assert_dom_equal(
|
43
43
|
"<option value=\"<Abe>\"><Abe> went home</option>\n<option value=\"Babe\">Babe went home</option>\n<option value=\"Cabe\">Cabe went home</option>",
|
44
44
|
options_from_collection_for_select(@posts, "author_name", "title")
|
45
45
|
)
|
@@ -53,7 +53,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
53
53
|
Post.new("Cabe went home", "Cabe", "To a little house", "shh!")
|
54
54
|
]
|
55
55
|
|
56
|
-
|
56
|
+
assert_dom_equal(
|
57
57
|
"<option value=\"<Abe>\"><Abe> went home</option>\n<option value=\"Babe\" selected=\"selected\">Babe went home</option>\n<option value=\"Cabe\">Cabe went home</option>",
|
58
58
|
options_from_collection_for_select(@posts, "author_name", "title", "Babe")
|
59
59
|
)
|
@@ -66,60 +66,60 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
66
66
|
Post.new("Cabe went home", "Cabe", "To a little house", "shh!")
|
67
67
|
]
|
68
68
|
|
69
|
-
|
69
|
+
assert_dom_equal(
|
70
70
|
"<option value=\"<Abe>\"><Abe> went home</option>\n<option value=\"Babe\" selected=\"selected\">Babe went home</option>\n<option value=\"Cabe\" selected=\"selected\">Cabe went home</option>",
|
71
71
|
options_from_collection_for_select(@posts, "author_name", "title", [ "Babe", "Cabe" ])
|
72
72
|
)
|
73
73
|
end
|
74
74
|
|
75
75
|
def test_array_options_for_select
|
76
|
-
|
76
|
+
assert_dom_equal(
|
77
77
|
"<option value=\"<Denmark>\"><Denmark></option>\n<option value=\"USA\">USA</option>\n<option value=\"Sweden\">Sweden</option>",
|
78
78
|
options_for_select([ "<Denmark>", "USA", "Sweden" ])
|
79
79
|
)
|
80
80
|
end
|
81
81
|
|
82
82
|
def test_array_options_for_select_with_selection
|
83
|
-
|
83
|
+
assert_dom_equal(
|
84
84
|
"<option value=\"Denmark\">Denmark</option>\n<option value=\"<USA>\" selected=\"selected\"><USA></option>\n<option value=\"Sweden\">Sweden</option>",
|
85
85
|
options_for_select([ "Denmark", "<USA>", "Sweden" ], "<USA>")
|
86
86
|
)
|
87
87
|
end
|
88
88
|
|
89
89
|
def test_array_options_for_select_with_selection_array
|
90
|
-
|
90
|
+
assert_dom_equal(
|
91
91
|
"<option value=\"Denmark\">Denmark</option>\n<option value=\"<USA>\" selected=\"selected\"><USA></option>\n<option value=\"Sweden\" selected=\"selected\">Sweden</option>",
|
92
92
|
options_for_select([ "Denmark", "<USA>", "Sweden" ], [ "<USA>", "Sweden" ])
|
93
93
|
)
|
94
94
|
end
|
95
95
|
|
96
96
|
def test_array_options_for_string_include_in_other_string_bug_fix
|
97
|
-
|
97
|
+
assert_dom_equal(
|
98
98
|
"<option value=\"ruby\">ruby</option>\n<option value=\"rubyonrails\" selected=\"selected\">rubyonrails</option>",
|
99
99
|
options_for_select([ "ruby", "rubyonrails" ], "rubyonrails")
|
100
100
|
)
|
101
|
-
|
101
|
+
assert_dom_equal(
|
102
102
|
"<option value=\"ruby\" selected=\"selected\">ruby</option>\n<option value=\"rubyonrails\">rubyonrails</option>",
|
103
103
|
options_for_select([ "ruby", "rubyonrails" ], "ruby")
|
104
104
|
)
|
105
105
|
end
|
106
106
|
|
107
107
|
def test_hash_options_for_select
|
108
|
-
|
108
|
+
assert_dom_equal(
|
109
109
|
"<option value=\"<Kroner>\"><DKR></option>\n<option value=\"Dollar\">$</option>",
|
110
110
|
options_for_select({ "$" => "Dollar", "<DKR>" => "<Kroner>" })
|
111
111
|
)
|
112
112
|
end
|
113
113
|
|
114
114
|
def test_hash_options_for_select_with_selection
|
115
|
-
|
115
|
+
assert_dom_equal(
|
116
116
|
"<option value=\"<Kroner>\"><DKR></option>\n<option value=\"Dollar\" selected=\"selected\">$</option>",
|
117
117
|
options_for_select({ "$" => "Dollar", "<DKR>" => "<Kroner>" }, "Dollar")
|
118
118
|
)
|
119
119
|
end
|
120
120
|
|
121
121
|
def test_hash_options_for_select_with_selection
|
122
|
-
|
122
|
+
assert_dom_equal(
|
123
123
|
"<option value=\"<Kroner>\" selected=\"selected\"><DKR></option>\n<option value=\"Dollar\" selected=\"selected\">$</option>",
|
124
124
|
options_for_select({ "$" => "Dollar", "<DKR>" => "<Kroner>" }, [ "Dollar", "<Kroner>" ])
|
125
125
|
)
|
@@ -131,7 +131,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
131
131
|
Continent.new("Europe", [Country.new("dk", "Denmark"), Country.new("ie", "Ireland")] )
|
132
132
|
]
|
133
133
|
|
134
|
-
|
134
|
+
assert_dom_equal(
|
135
135
|
"<optgroup label=\"<Africa>\"><option value=\"<sa>\"><South Africa></option>\n<option value=\"so\">Somalia</option></optgroup><optgroup label=\"Europe\"><option value=\"dk\" selected=\"selected\">Denmark</option>\n<option value=\"ie\">Ireland</option></optgroup>",
|
136
136
|
option_groups_from_collection_for_select(@continents, "countries", "continent_name", "country_id", "country_name", "dk")
|
137
137
|
)
|
@@ -139,7 +139,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
139
139
|
|
140
140
|
def test_time_zone_options_no_parms
|
141
141
|
opts = time_zone_options_for_select
|
142
|
-
|
142
|
+
assert_dom_equal "<option value=\"A\">A</option>\n" +
|
143
143
|
"<option value=\"B\">B</option>\n" +
|
144
144
|
"<option value=\"C\">C</option>\n" +
|
145
145
|
"<option value=\"D\">D</option>\n" +
|
@@ -149,7 +149,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
149
149
|
|
150
150
|
def test_time_zone_options_with_selected
|
151
151
|
opts = time_zone_options_for_select( "D" )
|
152
|
-
|
152
|
+
assert_dom_equal "<option value=\"A\">A</option>\n" +
|
153
153
|
"<option value=\"B\">B</option>\n" +
|
154
154
|
"<option value=\"C\">C</option>\n" +
|
155
155
|
"<option value=\"D\" selected=\"selected\">D</option>\n" +
|
@@ -159,7 +159,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
159
159
|
|
160
160
|
def test_time_zone_options_with_unknown_selected
|
161
161
|
opts = time_zone_options_for_select( "K" )
|
162
|
-
|
162
|
+
assert_dom_equal "<option value=\"A\">A</option>\n" +
|
163
163
|
"<option value=\"B\">B</option>\n" +
|
164
164
|
"<option value=\"C\">C</option>\n" +
|
165
165
|
"<option value=\"D\">D</option>\n" +
|
@@ -170,7 +170,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
170
170
|
def test_time_zone_options_with_priority_zones
|
171
171
|
zones = [ TimeZone.new( "B" ), TimeZone.new( "E" ) ]
|
172
172
|
opts = time_zone_options_for_select( nil, zones )
|
173
|
-
|
173
|
+
assert_dom_equal "<option value=\"B\">B</option>\n" +
|
174
174
|
"<option value=\"E\">E</option>" +
|
175
175
|
"<option value=\"\">-------------</option>\n" +
|
176
176
|
"<option value=\"A\">A</option>\n" +
|
@@ -182,7 +182,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
182
182
|
def test_time_zone_options_with_selected_priority_zones
|
183
183
|
zones = [ TimeZone.new( "B" ), TimeZone.new( "E" ) ]
|
184
184
|
opts = time_zone_options_for_select( "E", zones )
|
185
|
-
|
185
|
+
assert_dom_equal "<option value=\"B\">B</option>\n" +
|
186
186
|
"<option value=\"E\" selected=\"selected\">E</option>" +
|
187
187
|
"<option value=\"\">-------------</option>\n" +
|
188
188
|
"<option value=\"A\">A</option>\n" +
|
@@ -194,7 +194,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
194
194
|
def test_time_zone_options_with_unselected_priority_zones
|
195
195
|
zones = [ TimeZone.new( "B" ), TimeZone.new( "E" ) ]
|
196
196
|
opts = time_zone_options_for_select( "C", zones )
|
197
|
-
|
197
|
+
assert_dom_equal "<option value=\"B\">B</option>\n" +
|
198
198
|
"<option value=\"E\">E</option>" +
|
199
199
|
"<option value=\"\">-------------</option>\n" +
|
200
200
|
"<option value=\"A\">A</option>\n" +
|
@@ -206,7 +206,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
206
206
|
def test_select
|
207
207
|
@post = Post.new
|
208
208
|
@post.category = "<mus>"
|
209
|
-
|
209
|
+
assert_dom_equal(
|
210
210
|
"<select id=\"post_category\" name=\"post[category]\"><option value=\"abe\">abe</option>\n<option value=\"<mus>\" selected=\"selected\"><mus></option>\n<option value=\"hest\">hest</option></select>",
|
211
211
|
select("post", "category", %w( abe <mus> hest))
|
212
212
|
)
|
@@ -215,7 +215,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
215
215
|
def test_select_with_blank
|
216
216
|
@post = Post.new
|
217
217
|
@post.category = "<mus>"
|
218
|
-
|
218
|
+
assert_dom_equal(
|
219
219
|
"<select id=\"post_category\" name=\"post[category]\"><option value=\"\"></option>\n<option value=\"abe\">abe</option>\n<option value=\"<mus>\" selected=\"selected\"><mus></option>\n<option value=\"hest\">hest</option></select>",
|
220
220
|
select("post", "category", %w( abe <mus> hest), :include_blank => true)
|
221
221
|
)
|
@@ -224,7 +224,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
224
224
|
def test_select_with_default_prompt
|
225
225
|
@post = Post.new
|
226
226
|
@post.category = ""
|
227
|
-
|
227
|
+
assert_dom_equal(
|
228
228
|
"<select id=\"post_category\" name=\"post[category]\"><option value=\"\">Please select</option>\n<option value=\"abe\">abe</option>\n<option value=\"<mus>\"><mus></option>\n<option value=\"hest\">hest</option></select>",
|
229
229
|
select("post", "category", %w( abe <mus> hest), :prompt => true)
|
230
230
|
)
|
@@ -233,7 +233,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
233
233
|
def test_select_no_prompt_when_select_has_value
|
234
234
|
@post = Post.new
|
235
235
|
@post.category = "<mus>"
|
236
|
-
|
236
|
+
assert_dom_equal(
|
237
237
|
"<select id=\"post_category\" name=\"post[category]\"><option value=\"abe\">abe</option>\n<option value=\"<mus>\" selected=\"selected\"><mus></option>\n<option value=\"hest\">hest</option></select>",
|
238
238
|
select("post", "category", %w( abe <mus> hest), :prompt => true)
|
239
239
|
)
|
@@ -242,7 +242,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
242
242
|
def test_select_with_given_prompt
|
243
243
|
@post = Post.new
|
244
244
|
@post.category = ""
|
245
|
-
|
245
|
+
assert_dom_equal(
|
246
246
|
"<select id=\"post_category\" name=\"post[category]\"><option value=\"\">The prompt</option>\n<option value=\"abe\">abe</option>\n<option value=\"<mus>\"><mus></option>\n<option value=\"hest\">hest</option></select>",
|
247
247
|
select("post", "category", %w( abe <mus> hest), :prompt => 'The prompt')
|
248
248
|
)
|
@@ -251,7 +251,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
251
251
|
def test_select_with_prompt_and_blank
|
252
252
|
@post = Post.new
|
253
253
|
@post.category = ""
|
254
|
-
|
254
|
+
assert_dom_equal(
|
255
255
|
"<select id=\"post_category\" name=\"post[category]\"><option value=\"\">Please select</option>\n<option value=\"\"></option>\n<option value=\"abe\">abe</option>\n<option value=\"<mus>\"><mus></option>\n<option value=\"hest\">hest</option></select>",
|
256
256
|
select("post", "category", %w( abe <mus> hest), :prompt => true, :include_blank => true)
|
257
257
|
)
|
@@ -267,7 +267,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
267
267
|
@post = Post.new
|
268
268
|
@post.author_name = "Babe"
|
269
269
|
|
270
|
-
|
270
|
+
assert_dom_equal(
|
271
271
|
"<select id=\"post_author_name\" name=\"post[author_name]\"><option value=\"<Abe>\"><Abe></option>\n<option value=\"Babe\" selected=\"selected\">Babe</option>\n<option value=\"Cabe\">Cabe</option></select>",
|
272
272
|
collection_select("post", "author_name", @posts, "author_name", "author_name")
|
273
273
|
)
|
@@ -283,7 +283,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
283
283
|
@post = Post.new
|
284
284
|
@post.author_name = "Babe"
|
285
285
|
|
286
|
-
|
286
|
+
assert_dom_equal(
|
287
287
|
"<select id=\"post_author_name\" name=\"post[author_name]\" style=\"width: 200px\"><option value=\"\"></option>\n<option value=\"<Abe>\"><Abe></option>\n<option value=\"Babe\" selected=\"selected\">Babe</option>\n<option value=\"Cabe\">Cabe</option></select>",
|
288
288
|
collection_select("post", "author_name", @posts, "author_name", "author_name", { :include_blank => true }, "style" => "width: 200px")
|
289
289
|
)
|
@@ -292,7 +292,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
292
292
|
def test_country_select
|
293
293
|
@post = Post.new
|
294
294
|
@post.origin = "Denmark"
|
295
|
-
|
295
|
+
assert_dom_equal(
|
296
296
|
"<select id=\"post_origin\" name=\"post[origin]\"><option value=\"Afghanistan\">Afghanistan</option>\n<option value=\"Albania\">Albania</option>\n<option value=\"Algeria\">Algeria</option>\n<option value=\"American Samoa\">American Samoa</option>\n<option value=\"Andorra\">Andorra</option>\n<option value=\"Angola\">Angola</option>\n<option value=\"Anguilla\">Anguilla</option>\n<option value=\"Antarctica\">Antarctica</option>\n<option value=\"Antigua And Barbuda\">Antigua And Barbuda</option>\n<option value=\"Argentina\">Argentina</option>\n<option value=\"Armenia\">Armenia</option>\n<option value=\"Aruba\">Aruba</option>\n<option value=\"Australia\">Australia</option>\n<option value=\"Austria\">Austria</option>\n<option value=\"Azerbaijan\">Azerbaijan</option>\n<option value=\"Bahamas\">Bahamas</option>\n<option value=\"Bahrain\">Bahrain</option>\n<option value=\"Bangladesh\">Bangladesh</option>\n<option value=\"Barbados\">Barbados</option>\n<option value=\"Belarus\">Belarus</option>\n<option value=\"Belgium\">Belgium</option>\n<option value=\"Belize\">Belize</option>\n<option value=\"Benin\">Benin</option>\n<option value=\"Bermuda\">Bermuda</option>\n<option value=\"Bhutan\">Bhutan</option>\n<option value=\"Bolivia\">Bolivia</option>\n<option value=\"Bosnia and Herzegowina\">Bosnia and Herzegowina</option>\n<option value=\"Botswana\">Botswana</option>\n<option value=\"Bouvet Island\">Bouvet Island</option>\n<option value=\"Brazil\">Brazil</option>\n<option value=\"British Indian Ocean Territory\">British Indian Ocean Territory</option>\n<option value=\"Brunei Darussalam\">Brunei Darussalam</option>\n<option value=\"Bulgaria\">Bulgaria</option>\n<option value=\"Burkina Faso\">Burkina Faso</option>\n<option value=\"Burma\">Burma</option>\n<option value=\"Burundi\">Burundi</option>\n<option value=\"Cambodia\">Cambodia</option>\n<option value=\"Cameroon\">Cameroon</option>\n<option value=\"Canada\">Canada</option>\n<option value=\"Cape Verde\">Cape Verde</option>\n<option value=\"Cayman Islands\">Cayman Islands</option>\n<option value=\"Central African Republic\">Central African Republic</option>\n<option value=\"Chad\">Chad</option>\n<option value=\"Chile\">Chile</option>\n<option value=\"China\">China</option>\n<option value=\"Christmas Island\">Christmas Island</option>\n<option value=\"Cocos (Keeling) Islands\">Cocos (Keeling) Islands</option>\n<option value=\"Colombia\">Colombia</option>\n<option value=\"Comoros\">Comoros</option>\n<option value=\"Congo\">Congo</option>\n<option value=\"Congo, the Democratic Republic of the\">Congo, the Democratic Republic of the</option>\n<option value=\"Cook Islands\">Cook Islands</option>\n<option value=\"Costa Rica\">Costa Rica</option>\n<option value=\"Cote d'Ivoire\">Cote d'Ivoire</option>\n<option value=\"Croatia\">Croatia</option>\n<option value=\"Cuba\">Cuba</option>\n<option value=\"Cyprus\">Cyprus</option>\n<option value=\"Czech Republic\">Czech Republic</option>\n<option value=\"Denmark\" selected=\"selected\">Denmark</option>\n<option value=\"Djibouti\">Djibouti</option>\n<option value=\"Dominica\">Dominica</option>\n<option value=\"Dominican Republic\">Dominican Republic</option>\n<option value=\"East Timor\">East Timor</option>\n<option value=\"Ecuador\">Ecuador</option>\n<option value=\"Egypt\">Egypt</option>\n<option value=\"El Salvador\">El Salvador</option>\n<option value=\"England\">England" +
|
297
297
|
"</option>\n<option value=\"Equatorial Guinea\">Equatorial Guinea</option>\n<option value=\"Eritrea\">Eritrea</option>\n<option value=\"Espana\">Espana</option>\n<option value=\"Estonia\">Estonia</option>\n<option value=\"Ethiopia\">Ethiopia</option>\n<option value=\"Falkland Islands\">Falkland Islands</option>\n<option value=\"Faroe Islands\">Faroe Islands</option>\n<option value=\"Fiji\">Fiji</option>\n<option value=\"Finland\">Finland</option>\n<option value=\"France\">France</option>\n<option value=\"French Guiana\">French Guiana</option>\n<option value=\"French Polynesia\">French Polynesia</option>\n<option value=\"French Southern Territories\">French Southern Territories</option>\n<option value=\"Gabon\">Gabon</option>\n<option value=\"Gambia\">Gambia</option>\n<option value=\"Georgia\">Georgia</option>\n<option value=\"Germany\">Germany</option>\n<option value=\"Ghana\">Ghana</option>\n<option value=\"Gibraltar\">Gibraltar</option>\n<option value=\"Great Britain\">Great Britain</option>\n<option value=\"Greece\">Greece</option>\n<option value=\"Greenland\">Greenland</option>\n<option value=\"Grenada\">Grenada</option>\n<option value=\"Guadeloupe\">Guadeloupe</option>\n<option value=\"Guam\">Guam</option>\n<option value=\"Guatemala\">Guatemala</option>\n<option value=\"Guinea\">Guinea</option>\n<option value=\"Guinea-Bissau\">Guinea-Bissau</option>\n<option value=\"Guyana\">Guyana</option>\n<option value=\"Haiti\">Haiti</option>\n<option value=\"Heard and Mc Donald Islands\">Heard and Mc Donald Islands</option>\n<option value=\"Honduras\">Honduras</option>\n<option value=\"Hong Kong\">Hong Kong</option>\n<option value=\"Hungary\">Hungary</option>\n<option value=\"Iceland\">Iceland</option>\n<option value=\"India\">India</option>\n<option value=\"Indonesia\">Indonesia</option>\n<option value=\"Ireland\">Ireland</option>\n<option value=\"Israel\">Israel</option>\n<option value=\"Italy\">Italy</option>\n<option value=\"Iran\">Iran</option>\n<option value=\"Iraq\">Iraq</option>\n<option value=\"Jamaica\">Jamaica</option>\n<option value=\"Japan\">Japan</option>\n<option value=\"Jordan\">Jordan</option>\n<option value=\"Kazakhstan\">Kazakhstan</option>\n<option value=\"Kenya\">Kenya</option>\n<option value=\"Kiribati\">Kiribati</option>\n<option value=\"Korea, Republic of\">Korea, Republic of</option>\n<option value=\"Korea (South)\">Korea (South)</option>\n<option value=\"Kuwait\">Kuwait</option>\n<option value=\"Kyrgyzstan\">Kyrgyzstan</option>\n<option value=\"Lao People's Democratic Republic\">Lao People's Democratic Republic</option>\n<option value=\"Latvia\">Latvia</option>\n<option value=\"Lebanon\">Lebanon</option>\n<option value=\"Lesotho\">Lesotho</option>\n<option value=\"Liberia\">Liberia</option>\n<option value=\"Liechtenstein\">Liechtenstein</option>\n<option value=\"Lithuania\">Lithuania</option>\n<option value=\"Luxembourg\">Luxembourg</option>\n<option value=\"Macau\">Macau</option>\n<option value=\"Macedonia\">Macedonia</option>\n<option value=\"Madagascar\">Madagascar</option>\n<option value=\"Malawi\">Malawi</option>\n<option value=\"Malaysia\">Malaysia</option>\n<option value=\"Maldives\">Maldives</option>\n<option value=\"Mali\">Mali</option>\n<option value=\"Malta\">Malta</option>\n<option value=\"Marshall Islands\">Marshall Islands</option>\n<option value=\"Martinique\">Martinique</option>\n<option value=\"Mauritania\">Mauritania</option>\n<option value=\"Mauritius\">Mauritius</option>\n<option value=\"Mayotte\">Mayotte</option>\n<option value=\"Mexico\">Mexico</option>\n<option value=\"Micronesia, Federated States of\">Micronesia, Federated States of</option>\n<option value=\"Moldova, Republic of\">Moldova, Republic of</option>\n<option value=\"Monaco\">Monaco</option>\n<option value=\"Mongolia\">Mongolia</option>\n<option value=\"Montserrat\">Montserrat</option>\n<option value=\"Morocco\">Morocco</option>\n<option value=\"Mozambique\">Mozambique</option>\n<option value=\"Myanmar\">Myanmar</option>\n<option value=\"Namibia\">Namibia</option>\n<option value=\"Nauru\">Nauru</option>\n<option value=\"Nepal\">Nepal</option>\n<option value=\"Netherlands\">Netherlands</option>\n<option value=\"Netherlands Antilles\">Netherlands Antilles</option>\n<option value=\"New Caledonia\">New Caledonia</option>" +
|
298
298
|
"\n<option value=\"New Zealand\">New Zealand</option>\n<option value=\"Nicaragua\">Nicaragua</option>\n<option value=\"Niger\">Niger</option>\n<option value=\"Nigeria\">Nigeria</option>\n<option value=\"Niue\">Niue</option>\n<option value=\"Norfolk Island\">Norfolk Island</option>\n<option value=\"Northern Ireland\">Northern Ireland</option>\n<option value=\"Northern Mariana Islands\">Northern Mariana Islands</option>\n<option value=\"Norway\">Norway</option>\n<option value=\"Oman\">Oman</option>\n<option value=\"Pakistan\">Pakistan</option>\n<option value=\"Palau\">Palau</option>\n<option value=\"Panama\">Panama</option>\n<option value=\"Papua New Guinea\">Papua New Guinea</option>\n<option value=\"Paraguay\">Paraguay</option>\n<option value=\"Peru\">Peru</option>\n<option value=\"Philippines\">Philippines</option>\n<option value=\"Pitcairn\">Pitcairn</option>\n<option value=\"Poland\">Poland</option>\n<option value=\"Portugal\">Portugal</option>\n<option value=\"Puerto Rico\">Puerto Rico</option>\n<option value=\"Qatar\">Qatar</option>\n<option value=\"Reunion\">Reunion</option>\n<option value=\"Romania\">Romania</option>\n<option value=\"Russia\">Russia</option>\n<option value=\"Rwanda\">Rwanda</option>\n<option value=\"Saint Kitts and Nevis\">Saint Kitts and Nevis</option>\n<option value=\"Saint Lucia\">Saint Lucia</option>\n<option value=\"Saint Vincent and the Grenadines\">Saint Vincent and the Grenadines</option>\n<option value=\"Samoa (Independent)\">Samoa (Independent)</option>\n<option value=\"San Marino\">San Marino</option>\n<option value=\"Sao Tome and Principe\">Sao Tome and Principe</option>\n<option value=\"Saudi Arabia\">Saudi Arabia</option>\n<option value=\"Scotland\">Scotland</option>\n<option value=\"Senegal\">Senegal</option>\n<option value=\"Serbia and Montenegro\">Serbia and Montenegro</option>\n<option value=\"Seychelles\">Seychelles</option>\n<option value=\"Sierra Leone\">Sierra Leone</option>\n<option value=\"Singapore\">Singapore</option>\n<option value=\"Slovakia\">Slovakia</option>\n<option value=\"Slovenia\">Slovenia</option>\n<option value=\"Solomon Islands\">Solomon Islands</option>\n<option value=\"Somalia\">Somalia</option>\n<option value=\"South Africa\">South Africa</option>\n<option value=\"South Georgia and the South Sandwich Islands\">South Georgia and the South Sandwich Islands</option>\n<option value=\"South Korea\">South Korea</option>\n<option value=\"Spain\">Spain</option>\n<option value=\"Sri Lanka\">Sri Lanka</option>\n<option value=\"St. Helena\">St. Helena</option>\n<option value=\"St. Pierre and Miquelon\">St. Pierre and Miquelon</option>\n<option value=\"Suriname\">Suriname</option>\n<option value=\"Svalbard and Jan Mayen Islands\">Svalbard and Jan Mayen Islands</option>\n<option value=\"Swaziland\">Swaziland</option>\n<option value=\"Sweden\">Sweden</option>\n<option value=\"Switzerland\">Switzerland</option>\n<option value=\"Taiwan\">Taiwan</option>\n<option value=\"Tajikistan\">Tajikistan</option>\n<option value=\"Tanzania\">Tanzania</option>\n<option value=\"Thailand\">Thailand</option>\n<option value=\"Togo\">Togo</option>\n<option value=\"Tokelau\">Tokelau</option>\n<option value=\"Tonga\">Tonga</option>\n<option value=\"Trinidad\">Trinidad</option>\n<option value=\"Trinidad and Tobago\">Trinidad and Tobago</option>\n<option value=\"Tunisia\">Tunisia</option>\n<option value=\"Turkey\">Turkey</option>\n<option value=\"Turkmenistan\">" +
|
@@ -304,7 +304,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
304
304
|
def test_time_zone_select
|
305
305
|
@firm = Firm.new("D")
|
306
306
|
html = time_zone_select( "firm", "time_zone" )
|
307
|
-
|
307
|
+
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
|
308
308
|
"<option value=\"A\">A</option>\n" +
|
309
309
|
"<option value=\"B\">B</option>\n" +
|
310
310
|
"<option value=\"C\">C</option>\n" +
|
@@ -317,7 +317,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
317
317
|
def test_time_zone_select_with_blank
|
318
318
|
@firm = Firm.new("D")
|
319
319
|
html = time_zone_select("firm", "time_zone", nil, :include_blank => true)
|
320
|
-
|
320
|
+
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
|
321
321
|
"<option value=\"\"></option>\n" +
|
322
322
|
"<option value=\"A\">A</option>\n" +
|
323
323
|
"<option value=\"B\">B</option>\n" +
|
@@ -332,7 +332,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
332
332
|
@firm = Firm.new("D")
|
333
333
|
html = time_zone_select("firm", "time_zone", nil, {},
|
334
334
|
"style" => "color: red")
|
335
|
-
|
335
|
+
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\" style=\"color: red\">" +
|
336
336
|
"<option value=\"A\">A</option>\n" +
|
337
337
|
"<option value=\"B\">B</option>\n" +
|
338
338
|
"<option value=\"C\">C</option>\n" +
|
@@ -340,7 +340,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
340
340
|
"<option value=\"E\">E</option>" +
|
341
341
|
"</select>",
|
342
342
|
html
|
343
|
-
|
343
|
+
assert_dom_equal html, time_zone_select("firm", "time_zone", nil, {},
|
344
344
|
:style => "color: red")
|
345
345
|
end
|
346
346
|
|
@@ -348,7 +348,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
348
348
|
@firm = Firm.new("D")
|
349
349
|
html = time_zone_select("firm", "time_zone", nil,
|
350
350
|
{ :include_blank => true }, "style" => "color: red")
|
351
|
-
|
351
|
+
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\" style=\"color: red\">" +
|
352
352
|
"<option value=\"\"></option>\n" +
|
353
353
|
"<option value=\"A\">A</option>\n" +
|
354
354
|
"<option value=\"B\">B</option>\n" +
|
@@ -357,7 +357,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
357
357
|
"<option value=\"E\">E</option>" +
|
358
358
|
"</select>",
|
359
359
|
html
|
360
|
-
|
360
|
+
assert_dom_equal html, time_zone_select("firm", "time_zone", nil,
|
361
361
|
{ :include_blank => true }, :style => "color: red")
|
362
362
|
end
|
363
363
|
|
@@ -365,7 +365,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
365
365
|
@firm = Firm.new("D")
|
366
366
|
zones = [ TimeZone.new("A"), TimeZone.new("D") ]
|
367
367
|
html = time_zone_select("firm", "time_zone", zones )
|
368
|
-
|
368
|
+
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
|
369
369
|
"<option value=\"A\">A</option>\n" +
|
370
370
|
"<option value=\"D\" selected=\"selected\">D</option>" +
|
371
371
|
"<option value=\"\">-------------</option>\n" +
|