Permalink
Browse files

customizable label text

  • Loading branch information...
1 parent 4bf1fe5 commit 903559abb2fff89d46b7876f6c9dd3e3d7242d6e @fhwang committed Nov 1, 2009
View
@@ -21,7 +21,7 @@ def country_options_for_select(selected = nil, priority_countries = nil)
country_options += options_for_select(
priority_country_options, selected
)
- country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
+ country_options += "<option value=\"\" disabled=\"disabled\">#{CountryTime.label_text}</option>\n"
end
country_options << options_for_select(
CountryTime.unprioritized_options_for_select(value_type), selected
@@ -55,6 +55,9 @@ def country_select(method, priority_countries = nil, options = {}, html_options
module CountryTime
mattr_accessor :high_priority_countries
+ mattr_accessor :label_text
+ self.label_text = '-------------'
+
mattr_accessor :value_type
self.value_type = :a3
@@ -1,4 +1,4 @@
CountryTime.high_priority_countries = 'USA'
CountryTime.countries['TW'].name = 'Taiwan'
CountryTime.skip 'PRK'
-
+CountryTime.label_text = '----- Choose one -----'
@@ -29,5 +29,11 @@
it 'should allow us to skip some countries' do
response.should_not have_tag('option[value=?]', 'PRK')
end
+
+ it 'should let you customize label text' do
+ response.should have_tag(
+ 'option[disabled=disabled]', :text => "----- Choose one -----"
+ )
+ end
end
end

0 comments on commit 903559a

Please sign in to comment.