styled_inputs 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  *SVN*
2
2
 
3
+ *0.0.4* (June 3rd, 2008)
4
+
5
+ * Add support for Rails 2.0+
6
+
3
7
  *0.0.3* (June 1st, 2008)
4
8
 
5
9
  * Remove dependency on set_or_append
data/README CHANGED
@@ -43,4 +43,3 @@ specified is the type of input being generated.
43
43
  == Dependencies
44
44
 
45
45
  * Rails 2.0 or later
46
- * set_or_append[http://wiki.pluginaweek.org/Set_or_append]
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/gempackagetask'
4
4
  require 'rake/contrib/sshpublisher'
5
5
 
6
6
  PKG_NAME = 'styled_inputs'
7
- PKG_VERSION = '0.0.3'
7
+ PKG_VERSION = '0.0.4'
8
8
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
9
9
  RUBY_FORGE_PROJECT = 'pluginaweek'
10
10
 
@@ -8,8 +8,8 @@ module PluginAWeek #:nodoc:
8
8
  end
9
9
  end
10
10
 
11
- def tag_with_styled_inputs(name, options) #:nodoc:
12
- tag_without_styled_inputs(name, styled_input(name, options))
11
+ def tag_with_styled_inputs(name, options, *args) #:nodoc:
12
+ tag_without_styled_inputs(name, styled_input(name, options), *args)
13
13
  end
14
14
  end
15
15
  end
@@ -8,8 +8,8 @@ module PluginAWeek #:nodoc:
8
8
  end
9
9
  end
10
10
 
11
- def tag_with_styled_inputs(name, options = nil, open = false) #:nodoc:
12
- tag_without_styled_inputs(name, styled_input(name, options), open)
11
+ def tag_with_styled_inputs(name, options = nil, *args) #:nodoc:
12
+ tag_without_styled_inputs(name, styled_input(name, options), *args)
13
13
  end
14
14
  end
15
15
  end
data/lib/styled_inputs.rb CHANGED
@@ -25,8 +25,8 @@ module PluginAWeek #:nodoc:
25
25
  module StyledInputs
26
26
  # Appends the input type to the value currently stored in the html options
27
27
  # for the tag.
28
- def styled_input(name, options)
29
- options = options.stringify_keys
28
+ def styled_input(name, options = nil)
29
+ options = (options || {}).stringify_keys
30
30
 
31
31
  if name.to_s == 'input' && options.include?('type')
32
32
  options['class'] = (options['class'].to_s + " #{options['type']}").strip
@@ -127,3 +127,24 @@ class FormHelperTest < Test::Unit::TestCase
127
127
  assert_equal '<input class="radio" id="person_agree_1" name="person[agree]" type="radio" value="1" />', radio_button(:person, :agree, 1)
128
128
  end
129
129
  end
130
+
131
+ class TagHelperTest < Test::Unit::TestCase
132
+ include PluginAWeek::StyledInputs
133
+ include ActionView::Helpers::TagHelper
134
+
135
+ def test_should_allow_no_options_to_be_specified
136
+ assert_equal '<br />', tag('br')
137
+ end
138
+
139
+ def test_should_allow_options_to_be_specified
140
+ assert_equal '<input class="text" disabled="disabled" type="text" />', tag('input', {:type => 'text', :disabled => true})
141
+ end
142
+
143
+ def test_should_allow_open_to_be_specified
144
+ assert_equal '<br>', tag('br', nil, true)
145
+ end
146
+
147
+ def test_should_allow_escape_to_be_specified
148
+ assert_equal '<img src="open &amp; shut.png" />', tag('img', {:src => 'open &amp; shut.png'}, false, false)
149
+ end
150
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: styled_inputs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Pfeifer
@@ -9,7 +9,7 @@ autorequire: styled_inputs
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-01 00:00:00 -04:00
12
+ date: 2008-06-03 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15