trenni-formatters 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a57557f077c2dbb156b3a99f74ce6c8aa516a373
|
4
|
+
data.tar.gz: f5a01135f2c7c2349a97a46c58be7fc09b9375ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08018e55d97cc99a2a751d51834988f3f3980a255855c6f4e55682dfa881d03b380c10a07f08ea510b4251ff36ce4493e57ee3d6720526c9a2fef176a87a769e
|
7
|
+
data.tar.gz: e1a1ca5a88f82461bbeeba4163957e68d963871ab76434fb9bf0cad2668ab386556c6625910bde79cdac060ce461eed35c868095d383706c5b876c7e7cf0cde1
|
@@ -74,7 +74,9 @@ module Trenni
|
|
74
74
|
:id => options[:id],
|
75
75
|
:class => options[:class],
|
76
76
|
:value => value_for(options),
|
77
|
-
:required => options[:required]
|
77
|
+
:required => options[:required],
|
78
|
+
:disabled => options[:disabled],
|
79
|
+
:readonly => options[:readonly],
|
78
80
|
:pattern => pattern_for(options),
|
79
81
|
:placeholder => placeholder_for(options),
|
80
82
|
# for <input type="range|number">
|
@@ -103,7 +105,9 @@ module Trenni
|
|
103
105
|
:name => name_for(options),
|
104
106
|
:id => options[:id],
|
105
107
|
:class => options[:class],
|
106
|
-
:required => options[:required]
|
108
|
+
:required => options[:required],
|
109
|
+
:disabled => options[:disabled],
|
110
|
+
:readonly => options[:readonly],
|
107
111
|
:placeholder => placeholder_for(options),
|
108
112
|
}
|
109
113
|
end
|
@@ -115,7 +119,9 @@ module Trenni
|
|
115
119
|
:class => options[:class],
|
116
120
|
:checked => options[:object].send(name),
|
117
121
|
:name => name_for(options),
|
118
|
-
:required => options[:required]
|
122
|
+
:required => options[:required],
|
123
|
+
:disabled => options[:disabled],
|
124
|
+
:readonly => options[:readonly],
|
119
125
|
:value => 'true',
|
120
126
|
}
|
121
127
|
end
|
@@ -125,6 +131,7 @@ module Trenni
|
|
125
131
|
:type => options[:type] || 'submit',
|
126
132
|
:id => options[:id],
|
127
133
|
:class => options[:class],
|
134
|
+
:disabled => options[:disabled],
|
128
135
|
:name => name_for(options),
|
129
136
|
:value => title_for(options),
|
130
137
|
}
|
@@ -49,11 +49,9 @@ module Trenni::Formatters::FormFormatterSpec
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "<input>" do
|
52
|
+
let(:formatter) {FormFormatter.new(:object => double(:bar => 10))}
|
53
|
+
|
52
54
|
it "should support support min, max and step" do
|
53
|
-
object = double(:bar => 10)
|
54
|
-
|
55
|
-
formatter = FormFormatter.new(:object => object)
|
56
|
-
|
57
55
|
attributes = formatter.input_attributes_for(:min => 10, :max => 20, :step => 2)
|
58
56
|
|
59
57
|
expect(attributes[:min]).to be == 10
|
@@ -63,5 +61,19 @@ module Trenni::Formatters::FormFormatterSpec
|
|
63
61
|
output_tag = formatter.input(:field => :bar, :min => 10)
|
64
62
|
expect(output_tag).to be == %Q{<dt>Bar</dt>\n<dd><input name="bar" value="10" min="10"/></dd>}
|
65
63
|
end
|
64
|
+
|
65
|
+
it "should not specify required, readonly or disabled" do
|
66
|
+
attributes = formatter.input_attributes_for(:field => :bar)
|
67
|
+
expect(attributes[:required]).to be nil
|
68
|
+
expect(attributes[:readonly]).to be nil
|
69
|
+
expect(attributes[:disabled]).to be nil
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should specify required, readonly or disabled" do
|
73
|
+
attributes = formatter.input_attributes_for(:field => :bar, :required => true, :readonly => true, :disabled => true)
|
74
|
+
expect(attributes[:required]).to be true
|
75
|
+
expect(attributes[:readonly]).to be true
|
76
|
+
expect(attributes[:disabled]).to be true
|
77
|
+
end
|
66
78
|
end
|
67
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trenni-formatters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trenni
|