actionpack 1.13.6 → 2.0.0
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 +1400 -20
- data/MIT-LICENSE +1 -1
- data/README +5 -5
- data/RUNNING_UNIT_TESTS +4 -5
- data/Rakefile +5 -6
- data/install.rb +2 -2
- data/lib/action_controller.rb +11 -15
- data/lib/action_controller/assertions.rb +12 -25
- data/lib/action_controller/assertions/dom_assertions.rb +18 -4
- data/lib/action_controller/assertions/model_assertions.rb +8 -1
- data/lib/action_controller/assertions/response_assertions.rb +35 -12
- data/lib/action_controller/assertions/routing_assertions.rb +56 -12
- data/lib/action_controller/assertions/selector_assertions.rb +105 -38
- data/lib/action_controller/assertions/tag_assertions.rb +28 -15
- data/lib/action_controller/base.rb +318 -250
- data/lib/action_controller/benchmarking.rb +33 -29
- data/lib/action_controller/caching.rb +130 -64
- data/lib/action_controller/cgi_ext.rb +16 -0
- data/lib/action_controller/cgi_ext/{cookie_performance_fix.rb → cookie.rb} +25 -40
- data/lib/action_controller/cgi_ext/query_extension.rb +22 -0
- data/lib/action_controller/cgi_ext/session.rb +73 -0
- data/lib/action_controller/cgi_ext/stdinput.rb +23 -0
- data/lib/action_controller/cgi_process.rb +34 -57
- data/lib/action_controller/components.rb +19 -36
- data/lib/action_controller/cookies.rb +10 -9
- data/lib/action_controller/dispatcher.rb +195 -0
- data/lib/action_controller/filters.rb +35 -34
- data/lib/action_controller/flash.rb +30 -35
- data/lib/action_controller/helpers.rb +121 -47
- data/lib/action_controller/http_authentication.rb +126 -0
- data/lib/action_controller/integration.rb +105 -101
- data/lib/action_controller/layout.rb +59 -47
- data/lib/action_controller/mime_responds.rb +57 -68
- data/lib/action_controller/mime_type.rb +43 -80
- data/lib/action_controller/mime_types.rb +20 -0
- data/lib/action_controller/polymorphic_routes.rb +88 -0
- data/lib/action_controller/record_identifier.rb +91 -0
- data/lib/action_controller/request.rb +553 -88
- data/lib/action_controller/request_forgery_protection.rb +126 -0
- data/lib/action_controller/request_profiler.rb +138 -0
- data/lib/action_controller/rescue.rb +185 -69
- data/lib/action_controller/resources.rb +211 -172
- data/lib/action_controller/response.rb +49 -8
- data/lib/action_controller/routing.rb +359 -236
- data/lib/action_controller/routing_optimisation.rb +119 -0
- data/lib/action_controller/session/active_record_store.rb +3 -2
- data/lib/action_controller/session/cookie_store.rb +161 -0
- data/lib/action_controller/session/mem_cache_store.rb +9 -16
- data/lib/action_controller/session_management.rb +17 -8
- data/lib/action_controller/streaming.rb +6 -3
- data/lib/action_controller/templates/rescues/_request_and_response.erb +24 -0
- data/lib/action_controller/templates/rescues/{_trace.rhtml → _trace.erb} +0 -0
- data/lib/action_controller/templates/rescues/{diagnostics.rhtml → diagnostics.erb} +2 -2
- data/lib/action_controller/templates/rescues/{layout.rhtml → layout.erb} +0 -0
- data/lib/action_controller/templates/rescues/{missing_template.rhtml → missing_template.erb} +0 -0
- data/lib/action_controller/templates/rescues/{routing_error.rhtml → routing_error.erb} +0 -0
- data/lib/action_controller/templates/rescues/{template_error.rhtml → template_error.erb} +2 -2
- data/lib/action_controller/templates/rescues/{unknown_action.rhtml → unknown_action.erb} +0 -0
- data/lib/action_controller/test_case.rb +53 -0
- data/lib/action_controller/test_process.rb +59 -46
- data/lib/action_controller/url_rewriter.rb +48 -24
- data/lib/action_controller/vendor/html-scanner/html/document.rb +7 -4
- data/lib/action_controller/vendor/html-scanner/html/sanitizer.rb +173 -0
- data/lib/action_controller/vendor/html-scanner/html/selector.rb +11 -6
- data/lib/action_controller/verification.rb +27 -21
- data/lib/action_pack.rb +1 -1
- data/lib/action_pack/version.rb +4 -4
- data/lib/action_view.rb +2 -3
- data/lib/action_view/base.rb +218 -63
- data/lib/action_view/compiled_templates.rb +1 -2
- data/lib/action_view/helpers/active_record_helper.rb +35 -17
- data/lib/action_view/helpers/asset_tag_helper.rb +395 -87
- data/lib/action_view/helpers/atom_feed_helper.rb +111 -0
- data/lib/action_view/helpers/benchmark_helper.rb +12 -5
- data/lib/action_view/helpers/cache_helper.rb +29 -0
- data/lib/action_view/helpers/capture_helper.rb +97 -63
- data/lib/action_view/helpers/date_helper.rb +295 -35
- data/lib/action_view/helpers/debug_helper.rb +6 -2
- data/lib/action_view/helpers/form_helper.rb +354 -111
- data/lib/action_view/helpers/form_options_helper.rb +171 -109
- data/lib/action_view/helpers/form_tag_helper.rb +332 -76
- data/lib/action_view/helpers/javascript_helper.rb +35 -11
- data/lib/action_view/helpers/javascripts/controls.js +484 -354
- data/lib/action_view/helpers/javascripts/dragdrop.js +88 -58
- data/lib/action_view/helpers/javascripts/effects.js +396 -364
- data/lib/action_view/helpers/javascripts/prototype.js +2817 -1107
- data/lib/action_view/helpers/number_helper.rb +84 -60
- data/lib/action_view/helpers/prototype_helper.rb +419 -43
- data/lib/action_view/helpers/record_identification_helper.rb +20 -0
- data/lib/action_view/helpers/record_tag_helper.rb +59 -0
- data/lib/action_view/helpers/sanitize_helper.rb +223 -0
- data/lib/action_view/helpers/scriptaculous_helper.rb +63 -4
- data/lib/action_view/helpers/tag_helper.rb +69 -39
- data/lib/action_view/helpers/text_helper.rb +221 -148
- data/lib/action_view/helpers/url_helper.rb +283 -165
- data/lib/action_view/partials.rb +134 -62
- data/lib/action_view/template_error.rb +4 -12
- data/lib/actionpack.rb +1 -0
- data/test/abstract_unit.rb +21 -1
- data/test/action_view_test.rb +26 -0
- data/test/active_record_unit.rb +12 -20
- data/test/activerecord/active_record_store_test.rb +2 -2
- data/test/activerecord/render_partial_with_record_identification_test.rb +74 -0
- data/test/controller/action_pack_assertions_test.rb +21 -152
- data/test/controller/addresses_render_test.rb +2 -7
- data/test/controller/assert_select_test.rb +120 -14
- data/test/controller/base_test.rb +11 -13
- data/test/controller/caching_test.rb +125 -5
- data/test/controller/capture_test.rb +23 -16
- data/test/controller/cgi_test.rb +66 -391
- data/test/controller/components_test.rb +31 -42
- data/test/controller/content_type_test.rb +1 -1
- data/test/controller/cookie_test.rb +42 -14
- data/test/controller/deprecation/deprecated_base_methods_test.rb +1 -42
- data/test/controller/dispatcher_test.rb +123 -0
- data/test/controller/fake_models.rb +5 -0
- data/test/controller/filters_test.rb +44 -7
- data/test/controller/flash_test.rb +46 -2
- data/test/controller/fragment_store_setting_test.rb +10 -8
- data/test/controller/helper_test.rb +19 -2
- data/test/controller/html-scanner/document_test.rb +124 -0
- data/test/controller/html-scanner/node_test.rb +69 -0
- data/test/controller/html-scanner/sanitizer_test.rb +250 -0
- data/test/controller/html-scanner/tag_node_test.rb +239 -0
- data/test/controller/html-scanner/text_node_test.rb +51 -0
- data/test/controller/html-scanner/tokenizer_test.rb +125 -0
- data/test/controller/http_authentication_test.rb +54 -0
- data/test/controller/integration_test.rb +12 -26
- data/test/controller/layout_test.rb +64 -12
- data/test/controller/mime_responds_test.rb +193 -38
- data/test/controller/mime_type_test.rb +30 -8
- data/test/controller/new_render_test.rb +104 -22
- data/test/controller/polymorphic_routes_test.rb +98 -0
- data/test/controller/record_identifier_test.rb +103 -0
- data/test/controller/redirect_test.rb +120 -18
- data/test/controller/render_test.rb +195 -45
- data/test/controller/request_forgery_protection_test.rb +217 -0
- data/test/controller/request_test.rb +545 -27
- data/test/controller/rescue_test.rb +501 -0
- data/test/controller/resources_test.rb +258 -132
- data/test/controller/routing_test.rb +502 -106
- data/test/controller/selector_test.rb +5 -5
- data/test/controller/send_file_test.rb +17 -7
- data/test/controller/session/cookie_store_test.rb +246 -0
- data/test/controller/session/mem_cache_store_test.rb +182 -0
- data/test/controller/session_fixation_test.rb +8 -11
- data/test/controller/session_management_test.rb +7 -7
- data/test/controller/test_test.rb +150 -38
- data/test/controller/url_rewriter_test.rb +87 -12
- data/test/controller/verification_test.rb +11 -0
- data/test/controller/view_paths_test.rb +137 -0
- data/test/controller/webservice_test.rb +11 -75
- data/test/fixtures/addresses/{list.rhtml → list.erb} +0 -0
- data/test/fixtures/db_definitions/sqlite.sql +2 -1
- data/test/fixtures/developer.rb +2 -0
- data/test/fixtures/fun/games/{hello_world.rhtml → hello_world.erb} +0 -0
- data/test/fixtures/helpers/fun/pdf_helper.rb +1 -1
- data/test/fixtures/layout_tests/alt/hello.rhtml +1 -0
- data/test/fixtures/layout_tests/layouts/multiple_extensions.html.erb +1 -0
- data/test/fixtures/layouts/{builder.rxml → builder.builder} +0 -0
- data/test/fixtures/layouts/{standard.rhtml → standard.erb} +0 -0
- data/test/fixtures/layouts/{talk_from_action.rhtml → talk_from_action.erb} +0 -0
- data/test/fixtures/layouts/{yield.rhtml → yield.erb} +0 -0
- data/test/fixtures/multipart/binary_file +0 -0
- data/test/fixtures/multipart/bracketed_param +5 -0
- data/test/fixtures/override/test/hello_world.erb +1 -0
- data/test/fixtures/override2/layouts/test/sub.erb +1 -0
- data/test/fixtures/post_test/layouts/post.html.erb +1 -0
- data/test/fixtures/post_test/layouts/super_post.iphone.erb +1 -0
- data/test/fixtures/post_test/post/index.html.erb +1 -0
- data/test/fixtures/post_test/post/index.iphone.erb +1 -0
- data/test/fixtures/post_test/super_post/index.html.erb +1 -0
- data/test/fixtures/post_test/super_post/index.iphone.erb +1 -0
- data/test/fixtures/public/404.html +1 -0
- data/test/fixtures/public/500.html +1 -0
- data/test/fixtures/public/javascripts/application.js +0 -1
- data/test/fixtures/public/javascripts/bank.js +1 -0
- data/test/fixtures/public/javascripts/robber.js +1 -0
- data/test/fixtures/public/stylesheets/bank.css +1 -0
- data/test/fixtures/public/stylesheets/robber.css +1 -0
- data/test/fixtures/replies.yml +2 -0
- data/test/fixtures/reply.rb +2 -1
- data/test/fixtures/respond_to/{all_types_with_layout.rhtml → all_types_with_layout.html.erb} +0 -0
- data/test/fixtures/respond_to/{all_types_with_layout.rjs → all_types_with_layout.js.rjs} +0 -0
- data/test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb +1 -0
- data/test/fixtures/respond_to/iphone_with_html_response_type.html.erb +1 -0
- data/test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb +1 -0
- data/test/fixtures/respond_to/layouts/missing.html.erb +1 -0
- data/test/fixtures/respond_to/layouts/standard.html.erb +1 -0
- data/test/fixtures/respond_to/layouts/standard.iphone.erb +1 -0
- data/test/fixtures/respond_to/{using_defaults.rhtml → using_defaults.html.erb} +0 -0
- data/test/fixtures/respond_to/{using_defaults.rjs → using_defaults.js.rjs} +0 -0
- data/test/fixtures/respond_to/{using_defaults.rxml → using_defaults.xml.builder} +0 -0
- data/test/fixtures/respond_to/{using_defaults_with_type_list.rhtml → using_defaults_with_type_list.html.erb} +0 -0
- data/test/fixtures/respond_to/{using_defaults_with_type_list.rjs → using_defaults_with_type_list.js.rjs} +0 -0
- data/test/fixtures/respond_to/{using_defaults_with_type_list.rxml → using_defaults_with_type_list.xml.builder} +0 -0
- data/test/fixtures/scope/test/{modgreet.rhtml → modgreet.erb} +0 -0
- data/test/fixtures/test/{_customer.rhtml → _customer.erb} +0 -0
- data/test/fixtures/test/{_customer_greeting.rhtml → _customer_greeting.erb} +0 -0
- data/test/fixtures/test/_hash_greeting.erb +1 -0
- data/test/fixtures/test/_hash_object.erb +2 -0
- data/test/fixtures/test/{_hello.rxml → _hello.builder} +0 -0
- data/test/fixtures/test/_layout_for_partial.html.erb +3 -0
- data/test/fixtures/test/_partial.erb +1 -0
- data/test/fixtures/test/_partial.html.erb +1 -0
- data/test/fixtures/test/_partial.js.erb +1 -0
- data/test/fixtures/test/_partial_for_use_in_layout.html.erb +1 -0
- data/test/fixtures/test/{_partial_only.rhtml → _partial_only.erb} +0 -0
- data/test/fixtures/test/{_person.rhtml → _person.erb} +0 -0
- data/test/fixtures/test/{action_talk_to_layout.rhtml → action_talk_to_layout.erb} +0 -0
- data/test/fixtures/test/{block_content_for.rhtml → block_content_for.erb} +0 -0
- data/test/fixtures/test/calling_partial_with_layout.html.erb +1 -0
- data/test/fixtures/test/{capturing.rhtml → capturing.erb} +0 -0
- data/test/fixtures/test/{content_for.rhtml → content_for.erb} +0 -0
- data/test/fixtures/test/content_for_concatenated.erb +3 -0
- data/test/fixtures/test/content_for_with_parameter.erb +2 -0
- data/test/fixtures/test/dot.directory/{render_file_with_ivar.rhtml → render_file_with_ivar.erb} +0 -0
- data/test/fixtures/test/{erb_content_for.rhtml → erb_content_for.erb} +0 -0
- data/test/fixtures/test/formatted_html_erb.html.erb +1 -0
- data/test/fixtures/test/formatted_xml_erb.builder +1 -0
- data/test/fixtures/test/formatted_xml_erb.html.erb +1 -0
- data/test/fixtures/test/formatted_xml_erb.xml.erb +1 -0
- data/test/fixtures/test/{greeting.rhtml → greeting.erb} +0 -0
- data/test/fixtures/test/{hello.rxml → hello.builder} +0 -0
- data/test/fixtures/test/{hello_world.rxml → hello_world.builder} +0 -0
- data/test/fixtures/test/{hello_world.rhtml → hello_world.erb} +0 -0
- data/test/fixtures/test/{hello_world_container.rxml → hello_world_container.builder} +0 -0
- data/test/fixtures/test/{hello_world_with_layout_false.rhtml → hello_world_with_layout_false.erb} +0 -0
- data/test/fixtures/test/{hello_xml_world.rxml → hello_xml_world.builder} +0 -0
- data/test/fixtures/test/list.erb +1 -0
- data/test/fixtures/test/{non_erb_block_content_for.rxml → non_erb_block_content_for.builder} +0 -0
- data/test/fixtures/test/{potential_conflicts.rhtml → potential_conflicts.erb} +0 -0
- data/test/fixtures/test/{render_file_with_ivar.rhtml → render_file_with_ivar.erb} +0 -0
- data/test/fixtures/test/{render_file_with_locals.rhtml → render_file_with_locals.erb} +0 -0
- data/test/fixtures/test/{render_to_string_test.rhtml → render_to_string_test.erb} +0 -0
- data/test/fixtures/test/{update_element_with_capture.rhtml → update_element_with_capture.erb} +0 -0
- data/test/fixtures/test/using_layout_around_block.html.erb +1 -0
- data/test/fixtures/topic.rb +1 -1
- data/test/template/active_record_helper_test.rb +67 -20
- data/test/template/asset_tag_helper_test.rb +222 -54
- data/test/template/atom_feed_helper_test.rb +101 -0
- data/test/template/benchmark_helper_test.rb +2 -2
- data/test/template/compiled_templates_test.rb +76 -32
- data/test/template/date_helper_test.rb +125 -9
- data/test/template/form_helper_test.rb +326 -33
- data/test/template/form_options_helper_test.rb +822 -15
- data/test/template/form_tag_helper_test.rb +96 -30
- data/test/template/javascript_helper_test.rb +61 -13
- data/test/template/number_helper_test.rb +12 -11
- data/test/template/prototype_helper_test.rb +185 -24
- data/test/template/sanitize_helper_test.rb +49 -0
- data/test/template/scriptaculous_helper_test.rb +9 -3
- data/test/template/tag_helper_test.rb +13 -2
- data/test/template/text_helper_test.rb +38 -52
- data/test/template/url_helper_test.rb +216 -46
- metadata +144 -116
- data/examples/.htaccess +0 -24
- data/examples/address_book/index.rhtml +0 -33
- data/examples/address_book/layout.rhtml +0 -8
- data/examples/address_book_controller.cgi +0 -9
- data/examples/address_book_controller.fcgi +0 -6
- data/examples/address_book_controller.rb +0 -52
- data/examples/address_book_controller.rbx +0 -4
- data/examples/benchmark.rb +0 -52
- data/examples/benchmark_with_ar.fcgi +0 -89
- data/examples/blog_controller.cgi +0 -53
- data/examples/debate/index.rhtml +0 -14
- data/examples/debate/new_topic.rhtml +0 -22
- data/examples/debate/topic.rhtml +0 -32
- data/examples/debate_controller.cgi +0 -57
- data/lib/action_controller/assertions/deprecated_assertions.rb +0 -228
- data/lib/action_controller/cgi_ext/cgi_ext.rb +0 -36
- data/lib/action_controller/cgi_ext/cgi_methods.rb +0 -211
- data/lib/action_controller/cgi_ext/pstore_performance_fix.rb +0 -30
- data/lib/action_controller/cgi_ext/raw_post_data_fix.rb +0 -95
- data/lib/action_controller/cgi_ext/session_performance_fix.rb +0 -30
- data/lib/action_controller/deprecated_dependencies.rb +0 -65
- data/lib/action_controller/deprecated_redirects.rb +0 -17
- data/lib/action_controller/deprecated_request_methods.rb +0 -34
- data/lib/action_controller/macros/auto_complete.rb +0 -53
- data/lib/action_controller/macros/in_place_editing.rb +0 -33
- data/lib/action_controller/pagination.rb +0 -408
- data/lib/action_controller/scaffolding.rb +0 -189
- data/lib/action_controller/templates/rescues/_request_and_response.rhtml +0 -44
- data/lib/action_controller/templates/scaffolds/edit.rhtml +0 -7
- data/lib/action_controller/templates/scaffolds/layout.rhtml +0 -69
- data/lib/action_controller/templates/scaffolds/list.rhtml +0 -27
- data/lib/action_controller/templates/scaffolds/new.rhtml +0 -6
- data/lib/action_controller/templates/scaffolds/show.rhtml +0 -9
- data/lib/action_controller/vendor/xml_node.rb +0 -97
- data/lib/action_view/helpers/deprecated_helper.rb +0 -37
- data/lib/action_view/helpers/java_script_macros_helper.rb +0 -233
- data/lib/action_view/helpers/pagination_helper.rb +0 -86
- data/test/activerecord/active_record_assertions_test.rb +0 -92
- data/test/activerecord/pagination_test.rb +0 -165
- data/test/controller/deprecated_instance_variables_test.rb +0 -48
- data/test/controller/raw_post_test.rb +0 -68
- data/test/fixtures/deprecated_instance_variables/_cookies_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_cookies_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_flash_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_flash_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_headers_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_headers_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_params_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_params_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_request_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_request_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_response_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_response_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_session_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_session_method.rhtml +0 -1
- data/test/fixtures/respond_to/layouts/standard.rhtml +0 -1
- data/test/fixtures/test/_hash_object.rhtml +0 -1
- data/test/fixtures/test/list.rhtml +0 -1
- data/test/template/deprecated_helper_test.rb +0 -36
- data/test/template/deprecated_instance_variables_test.rb +0 -43
- data/test/template/java_script_macros_helper_test.rb +0 -109
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__)
|
1
|
+
require "#{File.dirname(__FILE__)}/../abstract_unit"
|
2
2
|
|
3
3
|
class MockTimeZone
|
4
4
|
attr_reader :name
|
@@ -140,7 +140,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
140
140
|
)
|
141
141
|
end
|
142
142
|
|
143
|
-
def
|
143
|
+
def test_option_groups_from_collection_for_select
|
144
144
|
@continents = [
|
145
145
|
Continent.new("<Africa>", [Country.new("<sa>", "<South Africa>"), Country.new("so", "Somalia")] ),
|
146
146
|
Continent.new("Europe", [Country.new("dk", "Denmark"), Country.new("ie", "Ireland")] )
|
@@ -187,7 +187,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
187
187
|
opts = time_zone_options_for_select( nil, zones )
|
188
188
|
assert_dom_equal "<option value=\"B\">B</option>\n" +
|
189
189
|
"<option value=\"E\">E</option>" +
|
190
|
-
"<option value=\"\">-------------</option>\n" +
|
190
|
+
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
|
191
191
|
"<option value=\"A\">A</option>\n" +
|
192
192
|
"<option value=\"C\">C</option>\n" +
|
193
193
|
"<option value=\"D\">D</option>",
|
@@ -199,7 +199,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
199
199
|
opts = time_zone_options_for_select( "E", zones )
|
200
200
|
assert_dom_equal "<option value=\"B\">B</option>\n" +
|
201
201
|
"<option value=\"E\" selected=\"selected\">E</option>" +
|
202
|
-
"<option value=\"\">-------------</option>\n" +
|
202
|
+
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
|
203
203
|
"<option value=\"A\">A</option>\n" +
|
204
204
|
"<option value=\"C\">C</option>\n" +
|
205
205
|
"<option value=\"D\">D</option>",
|
@@ -211,7 +211,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
211
211
|
opts = time_zone_options_for_select( "C", zones )
|
212
212
|
assert_dom_equal "<option value=\"B\">B</option>\n" +
|
213
213
|
"<option value=\"E\">E</option>" +
|
214
|
-
"<option value=\"\">-------------</option>\n" +
|
214
|
+
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
|
215
215
|
"<option value=\"A\">A</option>\n" +
|
216
216
|
"<option value=\"C\" selected=\"selected\">C</option>\n" +
|
217
217
|
"<option value=\"D\">D</option>",
|
@@ -252,6 +252,15 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
252
252
|
)
|
253
253
|
end
|
254
254
|
|
255
|
+
def test_select_with_blank_as_string
|
256
|
+
@post = Post.new
|
257
|
+
@post.category = "<mus>"
|
258
|
+
assert_dom_equal(
|
259
|
+
"<select id=\"post_category\" name=\"post[category]\"><option value=\"\">None</option>\n<option value=\"abe\">abe</option>\n<option value=\"<mus>\" selected=\"selected\"><mus></option>\n<option value=\"hest\">hest</option></select>",
|
260
|
+
select("post", "category", %w( abe <mus> hest), :include_blank => 'None')
|
261
|
+
)
|
262
|
+
end
|
263
|
+
|
255
264
|
def test_select_with_default_prompt
|
256
265
|
@post = Post.new
|
257
266
|
@post.category = ""
|
@@ -287,7 +296,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
287
296
|
select("post", "category", %w( abe <mus> hest), :prompt => true, :include_blank => true)
|
288
297
|
)
|
289
298
|
end
|
290
|
-
|
299
|
+
|
291
300
|
def test_select_with_selected_value
|
292
301
|
@post = Post.new
|
293
302
|
@post.category = "<mus>"
|
@@ -360,6 +369,22 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
360
369
|
)
|
361
370
|
end
|
362
371
|
|
372
|
+
def test_collection_select_with_blank_as_string_and_style
|
373
|
+
@posts = [
|
374
|
+
Post.new("<Abe> went home", "<Abe>", "To a little house", "shh!"),
|
375
|
+
Post.new("Babe went home", "Babe", "To a little house", "shh!"),
|
376
|
+
Post.new("Cabe went home", "Cabe", "To a little house", "shh!")
|
377
|
+
]
|
378
|
+
|
379
|
+
@post = Post.new
|
380
|
+
@post.author_name = "Babe"
|
381
|
+
|
382
|
+
assert_dom_equal(
|
383
|
+
"<select id=\"post_author_name\" name=\"post[author_name]\" style=\"width: 200px\"><option value=\"\">No Selection</option>\n<option value=\"<Abe>\"><Abe></option>\n<option value=\"Babe\" selected=\"selected\">Babe</option>\n<option value=\"Cabe\">Cabe</option></select>",
|
384
|
+
collection_select("post", "author_name", @posts, "author_name", "author_name", { :include_blank => 'No Selection' }, "style" => "width: 200px")
|
385
|
+
)
|
386
|
+
end
|
387
|
+
|
363
388
|
def test_collection_select_with_multiple_option_appends_array_brackets
|
364
389
|
@posts = [
|
365
390
|
Post.new("<Abe> went home", "<Abe>", "To a little house", "shh!"),
|
@@ -382,13 +407,764 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
382
407
|
def test_country_select
|
383
408
|
@post = Post.new
|
384
409
|
@post.origin = "Denmark"
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
410
|
+
expected_select = <<-COUNTRIES
|
411
|
+
<select id="post_origin" name="post[origin]"><option value="Afghanistan">Afghanistan</option>
|
412
|
+
<option value="Aland Islands">Aland Islands</option>
|
413
|
+
<option value="Albania">Albania</option>
|
414
|
+
<option value="Algeria">Algeria</option>
|
415
|
+
<option value="American Samoa">American Samoa</option>
|
416
|
+
<option value="Andorra">Andorra</option>
|
417
|
+
<option value="Angola">Angola</option>
|
418
|
+
<option value="Anguilla">Anguilla</option>
|
419
|
+
<option value="Antarctica">Antarctica</option>
|
420
|
+
<option value="Antigua And Barbuda">Antigua And Barbuda</option>
|
421
|
+
<option value="Argentina">Argentina</option>
|
422
|
+
<option value="Armenia">Armenia</option>
|
423
|
+
<option value="Aruba">Aruba</option>
|
424
|
+
<option value="Australia">Australia</option>
|
425
|
+
<option value="Austria">Austria</option>
|
426
|
+
<option value="Azerbaijan">Azerbaijan</option>
|
427
|
+
<option value="Bahamas">Bahamas</option>
|
428
|
+
<option value="Bahrain">Bahrain</option>
|
429
|
+
<option value="Bangladesh">Bangladesh</option>
|
430
|
+
<option value="Barbados">Barbados</option>
|
431
|
+
<option value="Belarus">Belarus</option>
|
432
|
+
<option value="Belgium">Belgium</option>
|
433
|
+
<option value="Belize">Belize</option>
|
434
|
+
<option value="Benin">Benin</option>
|
435
|
+
<option value="Bermuda">Bermuda</option>
|
436
|
+
<option value="Bhutan">Bhutan</option>
|
437
|
+
<option value="Bolivia">Bolivia</option>
|
438
|
+
<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option>
|
439
|
+
<option value="Botswana">Botswana</option>
|
440
|
+
<option value="Bouvet Island">Bouvet Island</option>
|
441
|
+
<option value="Brazil">Brazil</option>
|
442
|
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
443
|
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
444
|
+
<option value="Bulgaria">Bulgaria</option>
|
445
|
+
<option value="Burkina Faso">Burkina Faso</option>
|
446
|
+
<option value="Burundi">Burundi</option>
|
447
|
+
<option value="Cambodia">Cambodia</option>
|
448
|
+
<option value="Cameroon">Cameroon</option>
|
449
|
+
<option value="Canada">Canada</option>
|
450
|
+
<option value="Cape Verde">Cape Verde</option>
|
451
|
+
<option value="Cayman Islands">Cayman Islands</option>
|
452
|
+
<option value="Central African Republic">Central African Republic</option>
|
453
|
+
<option value="Chad">Chad</option>
|
454
|
+
<option value="Chile">Chile</option>
|
455
|
+
<option value="China">China</option>
|
456
|
+
<option value="Christmas Island">Christmas Island</option>
|
457
|
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
458
|
+
<option value="Colombia">Colombia</option>
|
459
|
+
<option value="Comoros">Comoros</option>
|
460
|
+
<option value="Congo">Congo</option>
|
461
|
+
<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option>
|
462
|
+
<option value="Cook Islands">Cook Islands</option>
|
463
|
+
<option value="Costa Rica">Costa Rica</option>
|
464
|
+
<option value="Cote d'Ivoire">Cote d'Ivoire</option>
|
465
|
+
<option value="Croatia">Croatia</option>
|
466
|
+
<option value="Cuba">Cuba</option>
|
467
|
+
<option value="Cyprus">Cyprus</option>
|
468
|
+
<option value="Czech Republic">Czech Republic</option>
|
469
|
+
<option selected="selected" value="Denmark">Denmark</option>
|
470
|
+
<option value="Djibouti">Djibouti</option>
|
471
|
+
<option value="Dominica">Dominica</option>
|
472
|
+
<option value="Dominican Republic">Dominican Republic</option>
|
473
|
+
<option value="Ecuador">Ecuador</option>
|
474
|
+
<option value="Egypt">Egypt</option>
|
475
|
+
<option value="El Salvador">El Salvador</option>
|
476
|
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
477
|
+
<option value="Eritrea">Eritrea</option>
|
478
|
+
<option value="Estonia">Estonia</option>
|
479
|
+
<option value="Ethiopia">Ethiopia</option>
|
480
|
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
481
|
+
<option value="Faroe Islands">Faroe Islands</option>
|
482
|
+
<option value="Fiji">Fiji</option>
|
483
|
+
<option value="Finland">Finland</option>
|
484
|
+
<option value="France">France</option>
|
485
|
+
<option value="French Guiana">French Guiana</option>
|
486
|
+
<option value="French Polynesia">French Polynesia</option>
|
487
|
+
<option value="French Southern Territories">French Southern Territories</option>
|
488
|
+
<option value="Gabon">Gabon</option>
|
489
|
+
<option value="Gambia">Gambia</option>
|
490
|
+
<option value="Georgia">Georgia</option>
|
491
|
+
<option value="Germany">Germany</option>
|
492
|
+
<option value="Ghana">Ghana</option>
|
493
|
+
<option value="Gibraltar">Gibraltar</option>
|
494
|
+
<option value="Greece">Greece</option>
|
495
|
+
<option value="Greenland">Greenland</option>
|
496
|
+
<option value="Grenada">Grenada</option>
|
497
|
+
<option value="Guadeloupe">Guadeloupe</option>
|
498
|
+
<option value="Guam">Guam</option>
|
499
|
+
<option value="Guatemala">Guatemala</option>
|
500
|
+
<option value="Guernsey">Guernsey</option>
|
501
|
+
<option value="Guinea">Guinea</option>
|
502
|
+
<option value="Guinea-Bissau">Guinea-Bissau</option>
|
503
|
+
<option value="Guyana">Guyana</option>
|
504
|
+
<option value="Haiti">Haiti</option>
|
505
|
+
<option value="Heard and McDonald Islands">Heard and McDonald Islands</option>
|
506
|
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
507
|
+
<option value="Honduras">Honduras</option>
|
508
|
+
<option value="Hong Kong">Hong Kong</option>
|
509
|
+
<option value="Hungary">Hungary</option>
|
510
|
+
<option value="Iceland">Iceland</option>
|
511
|
+
<option value="India">India</option>
|
512
|
+
<option value="Indonesia">Indonesia</option>
|
513
|
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
514
|
+
<option value="Iraq">Iraq</option>
|
515
|
+
<option value="Ireland">Ireland</option>
|
516
|
+
<option value="Isle of Man">Isle of Man</option>
|
517
|
+
<option value="Israel">Israel</option>
|
518
|
+
<option value="Italy">Italy</option>
|
519
|
+
<option value="Jamaica">Jamaica</option>
|
520
|
+
<option value="Japan">Japan</option>
|
521
|
+
<option value="Jersey">Jersey</option>
|
522
|
+
<option value="Jordan">Jordan</option>
|
523
|
+
<option value="Kazakhstan">Kazakhstan</option>
|
524
|
+
<option value="Kenya">Kenya</option>
|
525
|
+
<option value="Kiribati">Kiribati</option>
|
526
|
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
527
|
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
528
|
+
<option value="Kuwait">Kuwait</option>
|
529
|
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
530
|
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
531
|
+
<option value="Latvia">Latvia</option>
|
532
|
+
<option value="Lebanon">Lebanon</option>
|
533
|
+
<option value="Lesotho">Lesotho</option>
|
534
|
+
<option value="Liberia">Liberia</option>
|
535
|
+
<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
|
536
|
+
<option value="Liechtenstein">Liechtenstein</option>
|
537
|
+
<option value="Lithuania">Lithuania</option>
|
538
|
+
<option value="Luxembourg">Luxembourg</option>
|
539
|
+
<option value="Macao">Macao</option>
|
540
|
+
<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option>
|
541
|
+
<option value="Madagascar">Madagascar</option>
|
542
|
+
<option value="Malawi">Malawi</option>
|
543
|
+
<option value="Malaysia">Malaysia</option>
|
544
|
+
<option value="Maldives">Maldives</option>
|
545
|
+
<option value="Mali">Mali</option>
|
546
|
+
<option value="Malta">Malta</option>
|
547
|
+
<option value="Marshall Islands">Marshall Islands</option>
|
548
|
+
<option value="Martinique">Martinique</option>
|
549
|
+
<option value="Mauritania">Mauritania</option>
|
550
|
+
<option value="Mauritius">Mauritius</option>
|
551
|
+
<option value="Mayotte">Mayotte</option>
|
552
|
+
<option value="Mexico">Mexico</option>
|
553
|
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
554
|
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
555
|
+
<option value="Monaco">Monaco</option>
|
556
|
+
<option value="Mongolia">Mongolia</option>
|
557
|
+
<option value="Montenegro">Montenegro</option>
|
558
|
+
<option value="Montserrat">Montserrat</option>
|
559
|
+
<option value="Morocco">Morocco</option>
|
560
|
+
<option value="Mozambique">Mozambique</option>
|
561
|
+
<option value="Myanmar">Myanmar</option>
|
562
|
+
<option value="Namibia">Namibia</option>
|
563
|
+
<option value="Nauru">Nauru</option>
|
564
|
+
<option value="Nepal">Nepal</option>
|
565
|
+
<option value="Netherlands">Netherlands</option>
|
566
|
+
<option value="Netherlands Antilles">Netherlands Antilles</option>
|
567
|
+
<option value="New Caledonia">New Caledonia</option>
|
568
|
+
<option value="New Zealand">New Zealand</option>
|
569
|
+
<option value="Nicaragua">Nicaragua</option>
|
570
|
+
<option value="Niger">Niger</option>
|
571
|
+
<option value="Nigeria">Nigeria</option>
|
572
|
+
<option value="Niue">Niue</option>
|
573
|
+
<option value="Norfolk Island">Norfolk Island</option>
|
574
|
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
575
|
+
<option value="Norway">Norway</option>
|
576
|
+
<option value="Oman">Oman</option>
|
577
|
+
<option value="Pakistan">Pakistan</option>
|
578
|
+
<option value="Palau">Palau</option>
|
579
|
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
580
|
+
<option value="Panama">Panama</option>
|
581
|
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
582
|
+
<option value="Paraguay">Paraguay</option>
|
583
|
+
<option value="Peru">Peru</option>
|
584
|
+
<option value="Philippines">Philippines</option>
|
585
|
+
<option value="Pitcairn">Pitcairn</option>
|
586
|
+
<option value="Poland">Poland</option>
|
587
|
+
<option value="Portugal">Portugal</option>
|
588
|
+
<option value="Puerto Rico">Puerto Rico</option>
|
589
|
+
<option value="Qatar">Qatar</option>
|
590
|
+
<option value="Reunion">Reunion</option>
|
591
|
+
<option value="Romania">Romania</option>
|
592
|
+
<option value="Russian Federation">Russian Federation</option>
|
593
|
+
<option value="Rwanda">Rwanda</option>
|
594
|
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
595
|
+
<option value="Saint Helena">Saint Helena</option>
|
596
|
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
597
|
+
<option value="Saint Lucia">Saint Lucia</option>
|
598
|
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
599
|
+
<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
|
600
|
+
<option value="Samoa">Samoa</option>
|
601
|
+
<option value="San Marino">San Marino</option>
|
602
|
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
603
|
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
604
|
+
<option value="Senegal">Senegal</option>
|
605
|
+
<option value="Serbia">Serbia</option>
|
606
|
+
<option value="Seychelles">Seychelles</option>
|
607
|
+
<option value="Sierra Leone">Sierra Leone</option>
|
608
|
+
<option value="Singapore">Singapore</option>
|
609
|
+
<option value="Slovakia">Slovakia</option>
|
610
|
+
<option value="Slovenia">Slovenia</option>
|
611
|
+
<option value="Solomon Islands">Solomon Islands</option>
|
612
|
+
<option value="Somalia">Somalia</option>
|
613
|
+
<option value="South Africa">South Africa</option>
|
614
|
+
<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option>
|
615
|
+
<option value="Spain">Spain</option>
|
616
|
+
<option value="Sri Lanka">Sri Lanka</option>
|
617
|
+
<option value="Sudan">Sudan</option>
|
618
|
+
<option value="Suriname">Suriname</option>
|
619
|
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
620
|
+
<option value="Swaziland">Swaziland</option>
|
621
|
+
<option value="Sweden">Sweden</option>
|
622
|
+
<option value="Switzerland">Switzerland</option>
|
623
|
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
624
|
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
625
|
+
<option value="Tajikistan">Tajikistan</option>
|
626
|
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
627
|
+
<option value="Thailand">Thailand</option>
|
628
|
+
<option value="Timor-Leste">Timor-Leste</option>
|
629
|
+
<option value="Togo">Togo</option>
|
630
|
+
<option value="Tokelau">Tokelau</option>
|
631
|
+
<option value="Tonga">Tonga</option>
|
632
|
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
633
|
+
<option value="Tunisia">Tunisia</option>
|
634
|
+
<option value="Turkey">Turkey</option>
|
635
|
+
<option value="Turkmenistan">Turkmenistan</option>
|
636
|
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
637
|
+
<option value="Tuvalu">Tuvalu</option>
|
638
|
+
<option value="Uganda">Uganda</option>
|
639
|
+
<option value="Ukraine">Ukraine</option>
|
640
|
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
641
|
+
<option value="United Kingdom">United Kingdom</option>
|
642
|
+
<option value="United States">United States</option>
|
643
|
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
644
|
+
<option value="Uruguay">Uruguay</option>
|
645
|
+
<option value="Uzbekistan">Uzbekistan</option>
|
646
|
+
<option value="Vanuatu">Vanuatu</option>
|
647
|
+
<option value="Venezuela">Venezuela</option>
|
648
|
+
<option value="Viet Nam">Viet Nam</option>
|
649
|
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
650
|
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
651
|
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
652
|
+
<option value="Western Sahara">Western Sahara</option>
|
653
|
+
<option value="Yemen">Yemen</option>
|
654
|
+
<option value="Zambia">Zambia</option>
|
655
|
+
<option value="Zimbabwe">Zimbabwe</option></select>
|
656
|
+
COUNTRIES
|
657
|
+
assert_dom_equal(expected_select[0..-2], country_select("post", "origin"))
|
658
|
+
end
|
659
|
+
|
660
|
+
def test_country_select_with_priority_countries
|
661
|
+
@post = Post.new
|
662
|
+
@post.origin = "Denmark"
|
663
|
+
expected_select = <<-COUNTRIES
|
664
|
+
<select id="post_origin" name="post[origin]"><option value="New Zealand">New Zealand</option>
|
665
|
+
<option value="Nicaragua">Nicaragua</option><option value="" disabled="disabled">-------------</option>
|
666
|
+
<option value="Afghanistan">Afghanistan</option>
|
667
|
+
<option value="Aland Islands">Aland Islands</option>
|
668
|
+
<option value="Albania">Albania</option>
|
669
|
+
<option value="Algeria">Algeria</option>
|
670
|
+
<option value="American Samoa">American Samoa</option>
|
671
|
+
<option value="Andorra">Andorra</option>
|
672
|
+
<option value="Angola">Angola</option>
|
673
|
+
<option value="Anguilla">Anguilla</option>
|
674
|
+
<option value="Antarctica">Antarctica</option>
|
675
|
+
<option value="Antigua And Barbuda">Antigua And Barbuda</option>
|
676
|
+
<option value="Argentina">Argentina</option>
|
677
|
+
<option value="Armenia">Armenia</option>
|
678
|
+
<option value="Aruba">Aruba</option>
|
679
|
+
<option value="Australia">Australia</option>
|
680
|
+
<option value="Austria">Austria</option>
|
681
|
+
<option value="Azerbaijan">Azerbaijan</option>
|
682
|
+
<option value="Bahamas">Bahamas</option>
|
683
|
+
<option value="Bahrain">Bahrain</option>
|
684
|
+
<option value="Bangladesh">Bangladesh</option>
|
685
|
+
<option value="Barbados">Barbados</option>
|
686
|
+
<option value="Belarus">Belarus</option>
|
687
|
+
<option value="Belgium">Belgium</option>
|
688
|
+
<option value="Belize">Belize</option>
|
689
|
+
<option value="Benin">Benin</option>
|
690
|
+
<option value="Bermuda">Bermuda</option>
|
691
|
+
<option value="Bhutan">Bhutan</option>
|
692
|
+
<option value="Bolivia">Bolivia</option>
|
693
|
+
<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option>
|
694
|
+
<option value="Botswana">Botswana</option>
|
695
|
+
<option value="Bouvet Island">Bouvet Island</option>
|
696
|
+
<option value="Brazil">Brazil</option>
|
697
|
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
698
|
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
699
|
+
<option value="Bulgaria">Bulgaria</option>
|
700
|
+
<option value="Burkina Faso">Burkina Faso</option>
|
701
|
+
<option value="Burundi">Burundi</option>
|
702
|
+
<option value="Cambodia">Cambodia</option>
|
703
|
+
<option value="Cameroon">Cameroon</option>
|
704
|
+
<option value="Canada">Canada</option>
|
705
|
+
<option value="Cape Verde">Cape Verde</option>
|
706
|
+
<option value="Cayman Islands">Cayman Islands</option>
|
707
|
+
<option value="Central African Republic">Central African Republic</option>
|
708
|
+
<option value="Chad">Chad</option>
|
709
|
+
<option value="Chile">Chile</option>
|
710
|
+
<option value="China">China</option>
|
711
|
+
<option value="Christmas Island">Christmas Island</option>
|
712
|
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
713
|
+
<option value="Colombia">Colombia</option>
|
714
|
+
<option value="Comoros">Comoros</option>
|
715
|
+
<option value="Congo">Congo</option>
|
716
|
+
<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option>
|
717
|
+
<option value="Cook Islands">Cook Islands</option>
|
718
|
+
<option value="Costa Rica">Costa Rica</option>
|
719
|
+
<option value="Cote d'Ivoire">Cote d'Ivoire</option>
|
720
|
+
<option value="Croatia">Croatia</option>
|
721
|
+
<option value="Cuba">Cuba</option>
|
722
|
+
<option value="Cyprus">Cyprus</option>
|
723
|
+
<option value="Czech Republic">Czech Republic</option>
|
724
|
+
<option selected="selected" value="Denmark">Denmark</option>
|
725
|
+
<option value="Djibouti">Djibouti</option>
|
726
|
+
<option value="Dominica">Dominica</option>
|
727
|
+
<option value="Dominican Republic">Dominican Republic</option>
|
728
|
+
<option value="Ecuador">Ecuador</option>
|
729
|
+
<option value="Egypt">Egypt</option>
|
730
|
+
<option value="El Salvador">El Salvador</option>
|
731
|
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
732
|
+
<option value="Eritrea">Eritrea</option>
|
733
|
+
<option value="Estonia">Estonia</option>
|
734
|
+
<option value="Ethiopia">Ethiopia</option>
|
735
|
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
736
|
+
<option value="Faroe Islands">Faroe Islands</option>
|
737
|
+
<option value="Fiji">Fiji</option>
|
738
|
+
<option value="Finland">Finland</option>
|
739
|
+
<option value="France">France</option>
|
740
|
+
<option value="French Guiana">French Guiana</option>
|
741
|
+
<option value="French Polynesia">French Polynesia</option>
|
742
|
+
<option value="French Southern Territories">French Southern Territories</option>
|
743
|
+
<option value="Gabon">Gabon</option>
|
744
|
+
<option value="Gambia">Gambia</option>
|
745
|
+
<option value="Georgia">Georgia</option>
|
746
|
+
<option value="Germany">Germany</option>
|
747
|
+
<option value="Ghana">Ghana</option>
|
748
|
+
<option value="Gibraltar">Gibraltar</option>
|
749
|
+
<option value="Greece">Greece</option>
|
750
|
+
<option value="Greenland">Greenland</option>
|
751
|
+
<option value="Grenada">Grenada</option>
|
752
|
+
<option value="Guadeloupe">Guadeloupe</option>
|
753
|
+
<option value="Guam">Guam</option>
|
754
|
+
<option value="Guatemala">Guatemala</option>
|
755
|
+
<option value="Guernsey">Guernsey</option>
|
756
|
+
<option value="Guinea">Guinea</option>
|
757
|
+
<option value="Guinea-Bissau">Guinea-Bissau</option>
|
758
|
+
<option value="Guyana">Guyana</option>
|
759
|
+
<option value="Haiti">Haiti</option>
|
760
|
+
<option value="Heard and McDonald Islands">Heard and McDonald Islands</option>
|
761
|
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
762
|
+
<option value="Honduras">Honduras</option>
|
763
|
+
<option value="Hong Kong">Hong Kong</option>
|
764
|
+
<option value="Hungary">Hungary</option>
|
765
|
+
<option value="Iceland">Iceland</option>
|
766
|
+
<option value="India">India</option>
|
767
|
+
<option value="Indonesia">Indonesia</option>
|
768
|
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
769
|
+
<option value="Iraq">Iraq</option>
|
770
|
+
<option value="Ireland">Ireland</option>
|
771
|
+
<option value="Isle of Man">Isle of Man</option>
|
772
|
+
<option value="Israel">Israel</option>
|
773
|
+
<option value="Italy">Italy</option>
|
774
|
+
<option value="Jamaica">Jamaica</option>
|
775
|
+
<option value="Japan">Japan</option>
|
776
|
+
<option value="Jersey">Jersey</option>
|
777
|
+
<option value="Jordan">Jordan</option>
|
778
|
+
<option value="Kazakhstan">Kazakhstan</option>
|
779
|
+
<option value="Kenya">Kenya</option>
|
780
|
+
<option value="Kiribati">Kiribati</option>
|
781
|
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
782
|
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
783
|
+
<option value="Kuwait">Kuwait</option>
|
784
|
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
785
|
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
786
|
+
<option value="Latvia">Latvia</option>
|
787
|
+
<option value="Lebanon">Lebanon</option>
|
788
|
+
<option value="Lesotho">Lesotho</option>
|
789
|
+
<option value="Liberia">Liberia</option>
|
790
|
+
<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
|
791
|
+
<option value="Liechtenstein">Liechtenstein</option>
|
792
|
+
<option value="Lithuania">Lithuania</option>
|
793
|
+
<option value="Luxembourg">Luxembourg</option>
|
794
|
+
<option value="Macao">Macao</option>
|
795
|
+
<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option>
|
796
|
+
<option value="Madagascar">Madagascar</option>
|
797
|
+
<option value="Malawi">Malawi</option>
|
798
|
+
<option value="Malaysia">Malaysia</option>
|
799
|
+
<option value="Maldives">Maldives</option>
|
800
|
+
<option value="Mali">Mali</option>
|
801
|
+
<option value="Malta">Malta</option>
|
802
|
+
<option value="Marshall Islands">Marshall Islands</option>
|
803
|
+
<option value="Martinique">Martinique</option>
|
804
|
+
<option value="Mauritania">Mauritania</option>
|
805
|
+
<option value="Mauritius">Mauritius</option>
|
806
|
+
<option value="Mayotte">Mayotte</option>
|
807
|
+
<option value="Mexico">Mexico</option>
|
808
|
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
809
|
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
810
|
+
<option value="Monaco">Monaco</option>
|
811
|
+
<option value="Mongolia">Mongolia</option>
|
812
|
+
<option value="Montenegro">Montenegro</option>
|
813
|
+
<option value="Montserrat">Montserrat</option>
|
814
|
+
<option value="Morocco">Morocco</option>
|
815
|
+
<option value="Mozambique">Mozambique</option>
|
816
|
+
<option value="Myanmar">Myanmar</option>
|
817
|
+
<option value="Namibia">Namibia</option>
|
818
|
+
<option value="Nauru">Nauru</option>
|
819
|
+
<option value="Nepal">Nepal</option>
|
820
|
+
<option value="Netherlands">Netherlands</option>
|
821
|
+
<option value="Netherlands Antilles">Netherlands Antilles</option>
|
822
|
+
<option value="New Caledonia">New Caledonia</option>
|
823
|
+
<option value="New Zealand">New Zealand</option>
|
824
|
+
<option value="Nicaragua">Nicaragua</option>
|
825
|
+
<option value="Niger">Niger</option>
|
826
|
+
<option value="Nigeria">Nigeria</option>
|
827
|
+
<option value="Niue">Niue</option>
|
828
|
+
<option value="Norfolk Island">Norfolk Island</option>
|
829
|
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
830
|
+
<option value="Norway">Norway</option>
|
831
|
+
<option value="Oman">Oman</option>
|
832
|
+
<option value="Pakistan">Pakistan</option>
|
833
|
+
<option value="Palau">Palau</option>
|
834
|
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
835
|
+
<option value="Panama">Panama</option>
|
836
|
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
837
|
+
<option value="Paraguay">Paraguay</option>
|
838
|
+
<option value="Peru">Peru</option>
|
839
|
+
<option value="Philippines">Philippines</option>
|
840
|
+
<option value="Pitcairn">Pitcairn</option>
|
841
|
+
<option value="Poland">Poland</option>
|
842
|
+
<option value="Portugal">Portugal</option>
|
843
|
+
<option value="Puerto Rico">Puerto Rico</option>
|
844
|
+
<option value="Qatar">Qatar</option>
|
845
|
+
<option value="Reunion">Reunion</option>
|
846
|
+
<option value="Romania">Romania</option>
|
847
|
+
<option value="Russian Federation">Russian Federation</option>
|
848
|
+
<option value="Rwanda">Rwanda</option>
|
849
|
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
850
|
+
<option value="Saint Helena">Saint Helena</option>
|
851
|
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
852
|
+
<option value="Saint Lucia">Saint Lucia</option>
|
853
|
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
854
|
+
<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
|
855
|
+
<option value="Samoa">Samoa</option>
|
856
|
+
<option value="San Marino">San Marino</option>
|
857
|
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
858
|
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
859
|
+
<option value="Senegal">Senegal</option>
|
860
|
+
<option value="Serbia">Serbia</option>
|
861
|
+
<option value="Seychelles">Seychelles</option>
|
862
|
+
<option value="Sierra Leone">Sierra Leone</option>
|
863
|
+
<option value="Singapore">Singapore</option>
|
864
|
+
<option value="Slovakia">Slovakia</option>
|
865
|
+
<option value="Slovenia">Slovenia</option>
|
866
|
+
<option value="Solomon Islands">Solomon Islands</option>
|
867
|
+
<option value="Somalia">Somalia</option>
|
868
|
+
<option value="South Africa">South Africa</option>
|
869
|
+
<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option>
|
870
|
+
<option value="Spain">Spain</option>
|
871
|
+
<option value="Sri Lanka">Sri Lanka</option>
|
872
|
+
<option value="Sudan">Sudan</option>
|
873
|
+
<option value="Suriname">Suriname</option>
|
874
|
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
875
|
+
<option value="Swaziland">Swaziland</option>
|
876
|
+
<option value="Sweden">Sweden</option>
|
877
|
+
<option value="Switzerland">Switzerland</option>
|
878
|
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
879
|
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
880
|
+
<option value="Tajikistan">Tajikistan</option>
|
881
|
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
882
|
+
<option value="Thailand">Thailand</option>
|
883
|
+
<option value="Timor-Leste">Timor-Leste</option>
|
884
|
+
<option value="Togo">Togo</option>
|
885
|
+
<option value="Tokelau">Tokelau</option>
|
886
|
+
<option value="Tonga">Tonga</option>
|
887
|
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
888
|
+
<option value="Tunisia">Tunisia</option>
|
889
|
+
<option value="Turkey">Turkey</option>
|
890
|
+
<option value="Turkmenistan">Turkmenistan</option>
|
891
|
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
892
|
+
<option value="Tuvalu">Tuvalu</option>
|
893
|
+
<option value="Uganda">Uganda</option>
|
894
|
+
<option value="Ukraine">Ukraine</option>
|
895
|
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
896
|
+
<option value="United Kingdom">United Kingdom</option>
|
897
|
+
<option value="United States">United States</option>
|
898
|
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
899
|
+
<option value="Uruguay">Uruguay</option>
|
900
|
+
<option value="Uzbekistan">Uzbekistan</option>
|
901
|
+
<option value="Vanuatu">Vanuatu</option>
|
902
|
+
<option value="Venezuela">Venezuela</option>
|
903
|
+
<option value="Viet Nam">Viet Nam</option>
|
904
|
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
905
|
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
906
|
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
907
|
+
<option value="Western Sahara">Western Sahara</option>
|
908
|
+
<option value="Yemen">Yemen</option>
|
909
|
+
<option value="Zambia">Zambia</option>
|
910
|
+
<option value="Zimbabwe">Zimbabwe</option></select>
|
911
|
+
COUNTRIES
|
912
|
+
assert_dom_equal(expected_select[0..-2], country_select("post", "origin", ["New Zealand", "Nicaragua"]))
|
913
|
+
end
|
914
|
+
|
915
|
+
def test_country_select_with_selected_priority_country
|
916
|
+
@post = Post.new
|
917
|
+
@post.origin = "New Zealand"
|
918
|
+
expected_select = <<-COUNTRIES
|
919
|
+
<select id="post_origin" name="post[origin]"><option selected="selected" value="New Zealand">New Zealand</option>
|
920
|
+
<option value="Nicaragua">Nicaragua</option><option value="" disabled="disabled">-------------</option>
|
921
|
+
<option value="Afghanistan">Afghanistan</option>
|
922
|
+
<option value="Aland Islands">Aland Islands</option>
|
923
|
+
<option value="Albania">Albania</option>
|
924
|
+
<option value="Algeria">Algeria</option>
|
925
|
+
<option value="American Samoa">American Samoa</option>
|
926
|
+
<option value="Andorra">Andorra</option>
|
927
|
+
<option value="Angola">Angola</option>
|
928
|
+
<option value="Anguilla">Anguilla</option>
|
929
|
+
<option value="Antarctica">Antarctica</option>
|
930
|
+
<option value="Antigua And Barbuda">Antigua And Barbuda</option>
|
931
|
+
<option value="Argentina">Argentina</option>
|
932
|
+
<option value="Armenia">Armenia</option>
|
933
|
+
<option value="Aruba">Aruba</option>
|
934
|
+
<option value="Australia">Australia</option>
|
935
|
+
<option value="Austria">Austria</option>
|
936
|
+
<option value="Azerbaijan">Azerbaijan</option>
|
937
|
+
<option value="Bahamas">Bahamas</option>
|
938
|
+
<option value="Bahrain">Bahrain</option>
|
939
|
+
<option value="Bangladesh">Bangladesh</option>
|
940
|
+
<option value="Barbados">Barbados</option>
|
941
|
+
<option value="Belarus">Belarus</option>
|
942
|
+
<option value="Belgium">Belgium</option>
|
943
|
+
<option value="Belize">Belize</option>
|
944
|
+
<option value="Benin">Benin</option>
|
945
|
+
<option value="Bermuda">Bermuda</option>
|
946
|
+
<option value="Bhutan">Bhutan</option>
|
947
|
+
<option value="Bolivia">Bolivia</option>
|
948
|
+
<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option>
|
949
|
+
<option value="Botswana">Botswana</option>
|
950
|
+
<option value="Bouvet Island">Bouvet Island</option>
|
951
|
+
<option value="Brazil">Brazil</option>
|
952
|
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
953
|
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
954
|
+
<option value="Bulgaria">Bulgaria</option>
|
955
|
+
<option value="Burkina Faso">Burkina Faso</option>
|
956
|
+
<option value="Burundi">Burundi</option>
|
957
|
+
<option value="Cambodia">Cambodia</option>
|
958
|
+
<option value="Cameroon">Cameroon</option>
|
959
|
+
<option value="Canada">Canada</option>
|
960
|
+
<option value="Cape Verde">Cape Verde</option>
|
961
|
+
<option value="Cayman Islands">Cayman Islands</option>
|
962
|
+
<option value="Central African Republic">Central African Republic</option>
|
963
|
+
<option value="Chad">Chad</option>
|
964
|
+
<option value="Chile">Chile</option>
|
965
|
+
<option value="China">China</option>
|
966
|
+
<option value="Christmas Island">Christmas Island</option>
|
967
|
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
968
|
+
<option value="Colombia">Colombia</option>
|
969
|
+
<option value="Comoros">Comoros</option>
|
970
|
+
<option value="Congo">Congo</option>
|
971
|
+
<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option>
|
972
|
+
<option value="Cook Islands">Cook Islands</option>
|
973
|
+
<option value="Costa Rica">Costa Rica</option>
|
974
|
+
<option value="Cote d'Ivoire">Cote d'Ivoire</option>
|
975
|
+
<option value="Croatia">Croatia</option>
|
976
|
+
<option value="Cuba">Cuba</option>
|
977
|
+
<option value="Cyprus">Cyprus</option>
|
978
|
+
<option value="Czech Republic">Czech Republic</option>
|
979
|
+
<option value="Denmark">Denmark</option>
|
980
|
+
<option value="Djibouti">Djibouti</option>
|
981
|
+
<option value="Dominica">Dominica</option>
|
982
|
+
<option value="Dominican Republic">Dominican Republic</option>
|
983
|
+
<option value="Ecuador">Ecuador</option>
|
984
|
+
<option value="Egypt">Egypt</option>
|
985
|
+
<option value="El Salvador">El Salvador</option>
|
986
|
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
987
|
+
<option value="Eritrea">Eritrea</option>
|
988
|
+
<option value="Estonia">Estonia</option>
|
989
|
+
<option value="Ethiopia">Ethiopia</option>
|
990
|
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
991
|
+
<option value="Faroe Islands">Faroe Islands</option>
|
992
|
+
<option value="Fiji">Fiji</option>
|
993
|
+
<option value="Finland">Finland</option>
|
994
|
+
<option value="France">France</option>
|
995
|
+
<option value="French Guiana">French Guiana</option>
|
996
|
+
<option value="French Polynesia">French Polynesia</option>
|
997
|
+
<option value="French Southern Territories">French Southern Territories</option>
|
998
|
+
<option value="Gabon">Gabon</option>
|
999
|
+
<option value="Gambia">Gambia</option>
|
1000
|
+
<option value="Georgia">Georgia</option>
|
1001
|
+
<option value="Germany">Germany</option>
|
1002
|
+
<option value="Ghana">Ghana</option>
|
1003
|
+
<option value="Gibraltar">Gibraltar</option>
|
1004
|
+
<option value="Greece">Greece</option>
|
1005
|
+
<option value="Greenland">Greenland</option>
|
1006
|
+
<option value="Grenada">Grenada</option>
|
1007
|
+
<option value="Guadeloupe">Guadeloupe</option>
|
1008
|
+
<option value="Guam">Guam</option>
|
1009
|
+
<option value="Guatemala">Guatemala</option>
|
1010
|
+
<option value="Guernsey">Guernsey</option>
|
1011
|
+
<option value="Guinea">Guinea</option>
|
1012
|
+
<option value="Guinea-Bissau">Guinea-Bissau</option>
|
1013
|
+
<option value="Guyana">Guyana</option>
|
1014
|
+
<option value="Haiti">Haiti</option>
|
1015
|
+
<option value="Heard and McDonald Islands">Heard and McDonald Islands</option>
|
1016
|
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
1017
|
+
<option value="Honduras">Honduras</option>
|
1018
|
+
<option value="Hong Kong">Hong Kong</option>
|
1019
|
+
<option value="Hungary">Hungary</option>
|
1020
|
+
<option value="Iceland">Iceland</option>
|
1021
|
+
<option value="India">India</option>
|
1022
|
+
<option value="Indonesia">Indonesia</option>
|
1023
|
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
1024
|
+
<option value="Iraq">Iraq</option>
|
1025
|
+
<option value="Ireland">Ireland</option>
|
1026
|
+
<option value="Isle of Man">Isle of Man</option>
|
1027
|
+
<option value="Israel">Israel</option>
|
1028
|
+
<option value="Italy">Italy</option>
|
1029
|
+
<option value="Jamaica">Jamaica</option>
|
1030
|
+
<option value="Japan">Japan</option>
|
1031
|
+
<option value="Jersey">Jersey</option>
|
1032
|
+
<option value="Jordan">Jordan</option>
|
1033
|
+
<option value="Kazakhstan">Kazakhstan</option>
|
1034
|
+
<option value="Kenya">Kenya</option>
|
1035
|
+
<option value="Kiribati">Kiribati</option>
|
1036
|
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
1037
|
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
1038
|
+
<option value="Kuwait">Kuwait</option>
|
1039
|
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
1040
|
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
1041
|
+
<option value="Latvia">Latvia</option>
|
1042
|
+
<option value="Lebanon">Lebanon</option>
|
1043
|
+
<option value="Lesotho">Lesotho</option>
|
1044
|
+
<option value="Liberia">Liberia</option>
|
1045
|
+
<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
|
1046
|
+
<option value="Liechtenstein">Liechtenstein</option>
|
1047
|
+
<option value="Lithuania">Lithuania</option>
|
1048
|
+
<option value="Luxembourg">Luxembourg</option>
|
1049
|
+
<option value="Macao">Macao</option>
|
1050
|
+
<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option>
|
1051
|
+
<option value="Madagascar">Madagascar</option>
|
1052
|
+
<option value="Malawi">Malawi</option>
|
1053
|
+
<option value="Malaysia">Malaysia</option>
|
1054
|
+
<option value="Maldives">Maldives</option>
|
1055
|
+
<option value="Mali">Mali</option>
|
1056
|
+
<option value="Malta">Malta</option>
|
1057
|
+
<option value="Marshall Islands">Marshall Islands</option>
|
1058
|
+
<option value="Martinique">Martinique</option>
|
1059
|
+
<option value="Mauritania">Mauritania</option>
|
1060
|
+
<option value="Mauritius">Mauritius</option>
|
1061
|
+
<option value="Mayotte">Mayotte</option>
|
1062
|
+
<option value="Mexico">Mexico</option>
|
1063
|
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
1064
|
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
1065
|
+
<option value="Monaco">Monaco</option>
|
1066
|
+
<option value="Mongolia">Mongolia</option>
|
1067
|
+
<option value="Montenegro">Montenegro</option>
|
1068
|
+
<option value="Montserrat">Montserrat</option>
|
1069
|
+
<option value="Morocco">Morocco</option>
|
1070
|
+
<option value="Mozambique">Mozambique</option>
|
1071
|
+
<option value="Myanmar">Myanmar</option>
|
1072
|
+
<option value="Namibia">Namibia</option>
|
1073
|
+
<option value="Nauru">Nauru</option>
|
1074
|
+
<option value="Nepal">Nepal</option>
|
1075
|
+
<option value="Netherlands">Netherlands</option>
|
1076
|
+
<option value="Netherlands Antilles">Netherlands Antilles</option>
|
1077
|
+
<option value="New Caledonia">New Caledonia</option>
|
1078
|
+
<option selected="selected" value="New Zealand">New Zealand</option>
|
1079
|
+
<option value="Nicaragua">Nicaragua</option>
|
1080
|
+
<option value="Niger">Niger</option>
|
1081
|
+
<option value="Nigeria">Nigeria</option>
|
1082
|
+
<option value="Niue">Niue</option>
|
1083
|
+
<option value="Norfolk Island">Norfolk Island</option>
|
1084
|
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
1085
|
+
<option value="Norway">Norway</option>
|
1086
|
+
<option value="Oman">Oman</option>
|
1087
|
+
<option value="Pakistan">Pakistan</option>
|
1088
|
+
<option value="Palau">Palau</option>
|
1089
|
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
1090
|
+
<option value="Panama">Panama</option>
|
1091
|
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
1092
|
+
<option value="Paraguay">Paraguay</option>
|
1093
|
+
<option value="Peru">Peru</option>
|
1094
|
+
<option value="Philippines">Philippines</option>
|
1095
|
+
<option value="Pitcairn">Pitcairn</option>
|
1096
|
+
<option value="Poland">Poland</option>
|
1097
|
+
<option value="Portugal">Portugal</option>
|
1098
|
+
<option value="Puerto Rico">Puerto Rico</option>
|
1099
|
+
<option value="Qatar">Qatar</option>
|
1100
|
+
<option value="Reunion">Reunion</option>
|
1101
|
+
<option value="Romania">Romania</option>
|
1102
|
+
<option value="Russian Federation">Russian Federation</option>
|
1103
|
+
<option value="Rwanda">Rwanda</option>
|
1104
|
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
1105
|
+
<option value="Saint Helena">Saint Helena</option>
|
1106
|
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
1107
|
+
<option value="Saint Lucia">Saint Lucia</option>
|
1108
|
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
1109
|
+
<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
|
1110
|
+
<option value="Samoa">Samoa</option>
|
1111
|
+
<option value="San Marino">San Marino</option>
|
1112
|
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
1113
|
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
1114
|
+
<option value="Senegal">Senegal</option>
|
1115
|
+
<option value="Serbia">Serbia</option>
|
1116
|
+
<option value="Seychelles">Seychelles</option>
|
1117
|
+
<option value="Sierra Leone">Sierra Leone</option>
|
1118
|
+
<option value="Singapore">Singapore</option>
|
1119
|
+
<option value="Slovakia">Slovakia</option>
|
1120
|
+
<option value="Slovenia">Slovenia</option>
|
1121
|
+
<option value="Solomon Islands">Solomon Islands</option>
|
1122
|
+
<option value="Somalia">Somalia</option>
|
1123
|
+
<option value="South Africa">South Africa</option>
|
1124
|
+
<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option>
|
1125
|
+
<option value="Spain">Spain</option>
|
1126
|
+
<option value="Sri Lanka">Sri Lanka</option>
|
1127
|
+
<option value="Sudan">Sudan</option>
|
1128
|
+
<option value="Suriname">Suriname</option>
|
1129
|
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
1130
|
+
<option value="Swaziland">Swaziland</option>
|
1131
|
+
<option value="Sweden">Sweden</option>
|
1132
|
+
<option value="Switzerland">Switzerland</option>
|
1133
|
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
1134
|
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
1135
|
+
<option value="Tajikistan">Tajikistan</option>
|
1136
|
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
1137
|
+
<option value="Thailand">Thailand</option>
|
1138
|
+
<option value="Timor-Leste">Timor-Leste</option>
|
1139
|
+
<option value="Togo">Togo</option>
|
1140
|
+
<option value="Tokelau">Tokelau</option>
|
1141
|
+
<option value="Tonga">Tonga</option>
|
1142
|
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
1143
|
+
<option value="Tunisia">Tunisia</option>
|
1144
|
+
<option value="Turkey">Turkey</option>
|
1145
|
+
<option value="Turkmenistan">Turkmenistan</option>
|
1146
|
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
1147
|
+
<option value="Tuvalu">Tuvalu</option>
|
1148
|
+
<option value="Uganda">Uganda</option>
|
1149
|
+
<option value="Ukraine">Ukraine</option>
|
1150
|
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
1151
|
+
<option value="United Kingdom">United Kingdom</option>
|
1152
|
+
<option value="United States">United States</option>
|
1153
|
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
1154
|
+
<option value="Uruguay">Uruguay</option>
|
1155
|
+
<option value="Uzbekistan">Uzbekistan</option>
|
1156
|
+
<option value="Vanuatu">Vanuatu</option>
|
1157
|
+
<option value="Venezuela">Venezuela</option>
|
1158
|
+
<option value="Viet Nam">Viet Nam</option>
|
1159
|
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
1160
|
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
1161
|
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
1162
|
+
<option value="Western Sahara">Western Sahara</option>
|
1163
|
+
<option value="Yemen">Yemen</option>
|
1164
|
+
<option value="Zambia">Zambia</option>
|
1165
|
+
<option value="Zimbabwe">Zimbabwe</option></select>
|
1166
|
+
COUNTRIES
|
1167
|
+
assert_dom_equal(expected_select[0..-2], country_select("post", "origin", ["New Zealand", "Nicaragua"]))
|
392
1168
|
end
|
393
1169
|
|
394
1170
|
def test_time_zone_select
|
@@ -424,7 +1200,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
424
1200
|
_erbout
|
425
1201
|
)
|
426
1202
|
end
|
427
|
-
|
1203
|
+
|
428
1204
|
def test_time_zone_select_with_blank
|
429
1205
|
@firm = Firm.new("D")
|
430
1206
|
html = time_zone_select("firm", "time_zone", nil, :include_blank => true)
|
@@ -439,6 +1215,20 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
439
1215
|
html
|
440
1216
|
end
|
441
1217
|
|
1218
|
+
def test_time_zone_select_with_blank_as_string
|
1219
|
+
@firm = Firm.new("D")
|
1220
|
+
html = time_zone_select("firm", "time_zone", nil, :include_blank => 'No Zone')
|
1221
|
+
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
|
1222
|
+
"<option value=\"\">No Zone</option>\n" +
|
1223
|
+
"<option value=\"A\">A</option>\n" +
|
1224
|
+
"<option value=\"B\">B</option>\n" +
|
1225
|
+
"<option value=\"C\">C</option>\n" +
|
1226
|
+
"<option value=\"D\" selected=\"selected\">D</option>\n" +
|
1227
|
+
"<option value=\"E\">E</option>" +
|
1228
|
+
"</select>",
|
1229
|
+
html
|
1230
|
+
end
|
1231
|
+
|
442
1232
|
def test_time_zone_select_with_style
|
443
1233
|
@firm = Firm.new("D")
|
444
1234
|
html = time_zone_select("firm", "time_zone", nil, {},
|
@@ -472,6 +1262,23 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
472
1262
|
{ :include_blank => true }, :style => "color: red")
|
473
1263
|
end
|
474
1264
|
|
1265
|
+
def test_time_zone_select_with_blank_as_string_and_style
|
1266
|
+
@firm = Firm.new("D")
|
1267
|
+
html = time_zone_select("firm", "time_zone", nil,
|
1268
|
+
{ :include_blank => 'No Zone' }, "style" => "color: red")
|
1269
|
+
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\" style=\"color: red\">" +
|
1270
|
+
"<option value=\"\">No Zone</option>\n" +
|
1271
|
+
"<option value=\"A\">A</option>\n" +
|
1272
|
+
"<option value=\"B\">B</option>\n" +
|
1273
|
+
"<option value=\"C\">C</option>\n" +
|
1274
|
+
"<option value=\"D\" selected=\"selected\">D</option>\n" +
|
1275
|
+
"<option value=\"E\">E</option>" +
|
1276
|
+
"</select>",
|
1277
|
+
html
|
1278
|
+
assert_dom_equal html, time_zone_select("firm", "time_zone", nil,
|
1279
|
+
{ :include_blank => 'No Zone' }, :style => "color: red")
|
1280
|
+
end
|
1281
|
+
|
475
1282
|
def test_time_zone_select_with_priority_zones
|
476
1283
|
@firm = Firm.new("D")
|
477
1284
|
zones = [ TimeZone.new("A"), TimeZone.new("D") ]
|
@@ -479,7 +1286,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
|
|
479
1286
|
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
|
480
1287
|
"<option value=\"A\">A</option>\n" +
|
481
1288
|
"<option value=\"D\" selected=\"selected\">D</option>" +
|
482
|
-
"<option value=\"\">-------------</option>\n" +
|
1289
|
+
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
|
483
1290
|
"<option value=\"B\">B</option>\n" +
|
484
1291
|
"<option value=\"C\">C</option>\n" +
|
485
1292
|
"<option value=\"E\">E</option>" +
|