formotion 1.6 → 1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.travis.yml +0 -3
- data/Gemfile +4 -1
- data/LIST_OF_ROW_TYPES.md +58 -6
- data/Rakefile +6 -2
- data/app/app_delegate.rb +6 -0
- data/examples/KitchenSink/Gemfile +2 -1
- data/examples/KitchenSink/Rakefile +9 -4
- data/examples/KitchenSink/app/app_delegate.rb +20 -5
- data/examples/KitchenSink/resources/arrow-up.png +0 -0
- data/examples/KitchenSink/resources/arrow-up@2x.png +0 -0
- data/examples/KitchenSink/resources/email.png +0 -0
- data/examples/KitchenSink/resources/email@2x.png +0 -0
- data/examples/Persistence/app/app_delegate.rb +2 -0
- data/examples/Persistence/app/controller.rb +66 -0
- data/lib/formotion/controller/form_controller.rb +1 -1
- data/lib/formotion/form/form.rb +14 -5
- data/lib/formotion/model/formable.rb +8 -6
- data/lib/formotion/patch/ui_text_field.rb +15 -1
- data/lib/formotion/row/row.rb +19 -3
- data/lib/formotion/row/row_cell_builder.rb +48 -2
- data/lib/formotion/row_type/button.rb +2 -2
- data/lib/formotion/row_type/date_row.rb +8 -1
- data/lib/formotion/row_type/image_row.rb +2 -2
- data/lib/formotion/row_type/map_row.rb +60 -23
- data/lib/formotion/row_type/object_row.rb +2 -2
- data/lib/formotion/row_type/picker_row.rb +32 -0
- data/lib/formotion/row_type/string_row.rb +5 -2
- data/lib/formotion/row_type/web_link_row.rb +48 -0
- data/lib/formotion/version.rb +1 -1
- data/resources/camera.png +0 -0
- data/resources/camera@2x.png +0 -0
- data/spec/functional/map_row_spec.rb +151 -4
- data/spec/functional/web_link_row_spec.rb +35 -0
- data/spec/row_spec.rb +109 -1
- data/spec/row_type/web_link_spec.rb +23 -0
- metadata +13 -2
data/lib/formotion/version.rb
CHANGED
Binary file
|
Binary file
|
@@ -21,8 +21,8 @@ describe "FormController/MapRow" do
|
|
21
21
|
def map_row
|
22
22
|
@form.row(:map)
|
23
23
|
end
|
24
|
-
|
25
|
-
it "should only one pin" do
|
24
|
+
|
25
|
+
it "should have only one pin" do
|
26
26
|
map_row.object.annotations.size.should == 1
|
27
27
|
end
|
28
28
|
|
@@ -31,7 +31,7 @@ describe "FormController/MapRow" do
|
|
31
31
|
coord.latitude.should == 47.5
|
32
32
|
coord.longitude.should == 8.5
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should set a new pin with new position" do
|
36
36
|
map_row.value = CLLocationCoordinate2D.new(48.5, 9.5)
|
37
37
|
wait 1 do
|
@@ -42,4 +42,151 @@ describe "FormController/MapRow" do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
it "should have the default map type" do
|
46
|
+
wait 1 do
|
47
|
+
map_row.object.map.mapType.should == MKMapTypeStandard
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should allow map interaction" do
|
52
|
+
wait 1 do
|
53
|
+
map_row.object.map.isUserInteractionEnabled.should == true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "FormController/MapRow MapType" do
|
60
|
+
tests Formotion::FormController
|
61
|
+
|
62
|
+
# By default, `tests` uses @controller.init
|
63
|
+
# this isn't ideal for our case, so override.
|
64
|
+
def controller
|
65
|
+
row_settings = {
|
66
|
+
title: "Map",
|
67
|
+
key: :map,
|
68
|
+
type: :map,
|
69
|
+
value: {
|
70
|
+
coord: CLLocationCoordinate2D.new(48.5, 9.5),
|
71
|
+
type: MKMapTypeHybrid,
|
72
|
+
enabled: false
|
73
|
+
}
|
74
|
+
}
|
75
|
+
@form ||= Formotion::Form.new(
|
76
|
+
sections: [{
|
77
|
+
rows:[row_settings]
|
78
|
+
}])
|
79
|
+
|
80
|
+
@controller ||= Formotion::FormController.alloc.initWithForm(@form)
|
81
|
+
end
|
82
|
+
|
83
|
+
def map_row
|
84
|
+
@form.row(:map)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should have the hybrid map type" do
|
88
|
+
wait 1 do
|
89
|
+
map_row.object.map.mapType.should == MKMapTypeHybrid
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should not allow map interaction" do
|
94
|
+
wait 1 do
|
95
|
+
map_row.object.map.isUserInteractionEnabled.should == false
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "FormController/MapRow Pin" do
|
102
|
+
tests Formotion::FormController
|
103
|
+
|
104
|
+
# By default, `tests` uses @controller.init
|
105
|
+
# this isn't ideal for our case, so override.
|
106
|
+
def controller
|
107
|
+
row_settings = {
|
108
|
+
title: "Map",
|
109
|
+
key: :map,
|
110
|
+
type: :map,
|
111
|
+
value: {
|
112
|
+
coord: CLLocationCoordinate2D.new(48.5, 9.5),
|
113
|
+
pin: {
|
114
|
+
coord: CLLocationCoordinate2D.new(48.4, 9.4),
|
115
|
+
title: "Formotion",
|
116
|
+
subtitle: "Is Awesome"
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
@form ||= Formotion::Form.new(
|
121
|
+
sections: [{
|
122
|
+
rows:[row_settings]
|
123
|
+
}])
|
124
|
+
|
125
|
+
@controller ||= Formotion::FormController.alloc.initWithForm(@form)
|
126
|
+
end
|
127
|
+
|
128
|
+
def map_row
|
129
|
+
@form.row(:map)
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should have only one pin" do
|
133
|
+
map_row.object.annotations.size.should == 1
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should be a pin at the predefined position" do
|
137
|
+
coord = map_row.object.annotations[0].coordinate
|
138
|
+
coord.latitude.should.be.close 48.4, 0.2
|
139
|
+
coord.longitude.should.be.close 9.4, 0.2
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should be different than the map center" do
|
143
|
+
pin_coord = map_row.object.annotations[0].coordinate
|
144
|
+
map_center = map_row.object.map.centerCoordinate
|
145
|
+
|
146
|
+
pin_coord.should.not.be.same_as map_center
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should have a title" do
|
150
|
+
pin = map_row.object.annotations[0]
|
151
|
+
pin.title.should == "Formotion"
|
152
|
+
end
|
153
|
+
|
154
|
+
it "should have a subtitle" do
|
155
|
+
pin = map_row.object.annotations[0]
|
156
|
+
pin.subtitle.should == "Is Awesome"
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
describe "FormController/MapRow No Pin" do
|
162
|
+
tests Formotion::FormController
|
163
|
+
|
164
|
+
# By default, `tests` uses @controller.init
|
165
|
+
# this isn't ideal for our case, so override.
|
166
|
+
def controller
|
167
|
+
row_settings = {
|
168
|
+
title: "Map",
|
169
|
+
key: :map,
|
170
|
+
type: :map,
|
171
|
+
value: {
|
172
|
+
coord: CLLocationCoordinate2D.new(48.5, 9.5),
|
173
|
+
pin: nil
|
174
|
+
}
|
175
|
+
}
|
176
|
+
@form ||= Formotion::Form.new(
|
177
|
+
sections: [{
|
178
|
+
rows:[row_settings]
|
179
|
+
}])
|
180
|
+
|
181
|
+
@controller ||= Formotion::FormController.alloc.initWithForm(@form)
|
182
|
+
end
|
183
|
+
|
184
|
+
def map_row
|
185
|
+
@form.row(:map)
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should have zero pins" do
|
189
|
+
map_row.object.annotations.size.should == 0
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
describe "FormController/WebLinkRow" do
|
2
|
+
tests Formotion::FormController
|
3
|
+
|
4
|
+
# By default, `tests` uses @controller.init
|
5
|
+
# this isn't ideal for our case, so override.
|
6
|
+
def controller
|
7
|
+
row_settings = {
|
8
|
+
title: "WebLink",
|
9
|
+
key: :web_link,
|
10
|
+
type: :web_link,
|
11
|
+
value: "http://www.rubymotion.com"
|
12
|
+
}
|
13
|
+
@form ||= Formotion::Form.new(
|
14
|
+
sections: [{
|
15
|
+
rows:[row_settings]
|
16
|
+
}])
|
17
|
+
|
18
|
+
@controller ||= Formotion::FormController.alloc.initWithForm(@form)
|
19
|
+
end
|
20
|
+
|
21
|
+
def weblink_row
|
22
|
+
@form.row(:web_link)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should accept a string" do
|
26
|
+
weblink_row.value.should == "http://www.rubymotion.com"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should accept a NSURL" do
|
30
|
+
weblink_row.value = NSURL.URLWithString("http://www.rubymotion.com")
|
31
|
+
weblink_row.value.is_a?(NSURL).should == true
|
32
|
+
weblink_row.value.absoluteString.should == "http://www.rubymotion.com"
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/spec/row_spec.rb
CHANGED
@@ -1,4 +1,29 @@
|
|
1
1
|
describe "Rows" do
|
2
|
+
|
3
|
+
before do
|
4
|
+
@image_name = "tags_row"
|
5
|
+
@image = UIImage.imageNamed(@image_name)
|
6
|
+
@remote_image_url = "http://placekitten.com/80/80?t=#{Time.now.to_i}"
|
7
|
+
@remote_placeholder_image_name = 'camera'
|
8
|
+
@remote_placeholder_image = UIImage.imageNamed(@remote_placeholder_image_name)
|
9
|
+
|
10
|
+
string_hash = {title: "TITLE", subtitle: "SUBTITLE", image: @image_name, type: :object, section: Formotion::Section.new({index: 0})}
|
11
|
+
@string_image_row = Formotion::Row.new(string_hash)
|
12
|
+
@string_image_row.index = 0
|
13
|
+
|
14
|
+
image_hash = string_hash.merge({image: @image})
|
15
|
+
@image_row = Formotion::Row.new(image_hash)
|
16
|
+
@image_row.index = 0
|
17
|
+
|
18
|
+
remote_image_hash = image_hash.merge({image: @remote_image_url})
|
19
|
+
@remote_image_row = Formotion::Row.new(remote_image_hash)
|
20
|
+
@remote_image_row.index = 0
|
21
|
+
|
22
|
+
remote_placeholder_image_hash = remote_image_hash.merge({image_placeholder: @remote_placeholder_image})
|
23
|
+
@remote_placeholder_image_row = Formotion::Row.new(remote_placeholder_image_hash)
|
24
|
+
@remote_placeholder_image_row.index = 0
|
25
|
+
end
|
26
|
+
|
2
27
|
it "method_missing should work" do
|
3
28
|
r = Formotion::Row.new
|
4
29
|
r.title = "LABEL"
|
@@ -13,6 +38,89 @@ describe "Rows" do
|
|
13
38
|
r = Formotion::Row.new(hash)
|
14
39
|
r.title.should == "TITLE"
|
15
40
|
r.subtitle.should == "SUBTITLE"
|
41
|
+
r.image.should == nil
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should set an image on the cell with a String" do
|
45
|
+
@string_image_row.image.should == @image_name
|
46
|
+
|
47
|
+
cell = @string_image_row.make_cell
|
48
|
+
cell.imageView.image.should.not == nil
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should set an image on the cell with a UIImage" do
|
52
|
+
@image_row.image.should == @image
|
53
|
+
|
54
|
+
cell = @image_row.make_cell
|
55
|
+
cell.imageView.image.should == @image
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should change the image after cell creation" do
|
59
|
+
@image_row.image.should == @image
|
60
|
+
|
61
|
+
cell = @image_row.make_cell
|
62
|
+
cell.imageView.image.should == @image
|
63
|
+
|
64
|
+
new_image = UIImage.imageNamed("camera")
|
65
|
+
@image_row.image = new_image
|
66
|
+
|
67
|
+
cell.imageView.image.should.not == @image
|
68
|
+
cell.imageView.image.should == new_image
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should set an image on the cell using a remote URL" do
|
72
|
+
|
73
|
+
@remote_image_row.image.should == @remote_image_url
|
74
|
+
|
75
|
+
cell = @remote_image_row.make_cell
|
76
|
+
|
77
|
+
wait 1 do
|
78
|
+
cell.imageView.image.should != nil
|
79
|
+
cell.imageView.image.is_a?(UIImage).should == true
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should set a remote image with a placeholder" do
|
85
|
+
@remote_placeholder_image_row.image.should == @remote_image_url
|
86
|
+
@remote_placeholder_image_row.image_placeholder.should == @remote_placeholder_image
|
87
|
+
|
88
|
+
cell = @remote_placeholder_image_row.make_cell
|
89
|
+
|
90
|
+
wait 1 do
|
91
|
+
cell.imageView.image.size.should != @remote_placeholder_image.size
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should set a remote image after another image has already been set" do
|
96
|
+
cell = @remote_placeholder_image_row.make_cell
|
97
|
+
|
98
|
+
wait 1 do
|
99
|
+
img = cell.imageView.image
|
100
|
+
cell.imageView.image.size.should != @remote_placeholder_image.size
|
101
|
+
|
102
|
+
@remote_placeholder_image_row.image = "http://placekitten.com/80/80?t=#{Time.now.to_i}"
|
103
|
+
wait 1 do
|
104
|
+
cell.imageView.image.should != img
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should set a local image after a remote image has already been set" do
|
111
|
+
cell = @remote_placeholder_image_row.make_cell
|
112
|
+
|
113
|
+
wait 1 do
|
114
|
+
img = cell.imageView.image
|
115
|
+
cell.imageView.image.size.should != @remote_placeholder_image.size
|
116
|
+
|
117
|
+
new_image = UIImage.imageNamed("camera")
|
118
|
+
@remote_placeholder_image_row.image = new_image
|
119
|
+
|
120
|
+
cell.imageView.image.should.not == img
|
121
|
+
cell.imageView.image.should == new_image
|
122
|
+
end
|
123
|
+
|
16
124
|
end
|
17
125
|
|
18
126
|
it "the question mark methods should work" do
|
@@ -31,4 +139,4 @@ describe "Rows" do
|
|
31
139
|
r.items = lambda { [1, 2, 3].reverse }
|
32
140
|
r.items.should == [3, 2, 1]
|
33
141
|
end
|
34
|
-
end
|
142
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
describe "Web Link Row" do
|
2
|
+
tests_row :web_link
|
3
|
+
|
4
|
+
before do
|
5
|
+
@link_url = "http://www.rubymotion.com"
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should initialize with correct settings" do
|
9
|
+
@row.object.class.should == Formotion::RowType::WebLinkRow
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have a cell indicator" do
|
13
|
+
cell = @row.make_cell
|
14
|
+
cell.accessoryType.should == UITableViewCellAccessoryDisclosureIndicator
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should accept a string value" do
|
18
|
+
@row.value = @link_url
|
19
|
+
cell = @row.make_cell
|
20
|
+
@row.value.is_a?(String).should == true
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clay Allsopp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bubble-wrap
|
@@ -82,6 +82,10 @@ files:
|
|
82
82
|
- examples/KitchenSink/README.md
|
83
83
|
- examples/KitchenSink/Rakefile
|
84
84
|
- examples/KitchenSink/app/app_delegate.rb
|
85
|
+
- examples/KitchenSink/resources/arrow-up.png
|
86
|
+
- examples/KitchenSink/resources/arrow-up@2x.png
|
87
|
+
- examples/KitchenSink/resources/email.png
|
88
|
+
- examples/KitchenSink/resources/email@2x.png
|
85
89
|
- examples/KitchenSink/spec/main_spec.rb
|
86
90
|
- examples/Login/.gitignore
|
87
91
|
- examples/Login/Rakefile
|
@@ -162,9 +166,12 @@ files:
|
|
162
166
|
- lib/formotion/row_type/tags_row.rb
|
163
167
|
- lib/formotion/row_type/template_row.rb
|
164
168
|
- lib/formotion/row_type/text_row.rb
|
169
|
+
- lib/formotion/row_type/web_link_row.rb
|
165
170
|
- lib/formotion/row_type/web_view_row.rb
|
166
171
|
- lib/formotion/section/section.rb
|
167
172
|
- lib/formotion/version.rb
|
173
|
+
- resources/camera.png
|
174
|
+
- resources/camera@2x.png
|
168
175
|
- resources/tags_row-selected.png
|
169
176
|
- resources/tags_row-selected@2x.png
|
170
177
|
- resources/tags_row.png
|
@@ -189,6 +196,7 @@ files:
|
|
189
196
|
- spec/functional/template_row_ext_spec.rb
|
190
197
|
- spec/functional/template_row_spec.rb
|
191
198
|
- spec/functional/text_row_spec.rb
|
199
|
+
- spec/functional/web_link_row_spec.rb
|
192
200
|
- spec/functional/web_view_row_spec.rb
|
193
201
|
- spec/helpers/row_test_helpers.rb
|
194
202
|
- spec/row_spec.rb
|
@@ -211,6 +219,7 @@ files:
|
|
211
219
|
- spec/row_type/switch_spec.rb
|
212
220
|
- spec/row_type/template_spec.rb
|
213
221
|
- spec/row_type/text_spec.rb
|
222
|
+
- spec/row_type/web_link_spec.rb
|
214
223
|
- spec/section_spec.rb
|
215
224
|
- spec/support/ui_control_wrap_extension.rb
|
216
225
|
homepage: https://github.com/clayallsopp/Formotion
|
@@ -258,6 +267,7 @@ test_files:
|
|
258
267
|
- spec/functional/template_row_ext_spec.rb
|
259
268
|
- spec/functional/template_row_spec.rb
|
260
269
|
- spec/functional/text_row_spec.rb
|
270
|
+
- spec/functional/web_link_row_spec.rb
|
261
271
|
- spec/functional/web_view_row_spec.rb
|
262
272
|
- spec/helpers/row_test_helpers.rb
|
263
273
|
- spec/row_spec.rb
|
@@ -280,5 +290,6 @@ test_files:
|
|
280
290
|
- spec/row_type/switch_spec.rb
|
281
291
|
- spec/row_type/template_spec.rb
|
282
292
|
- spec/row_type/text_spec.rb
|
293
|
+
- spec/row_type/web_link_spec.rb
|
283
294
|
- spec/section_spec.rb
|
284
295
|
- spec/support/ui_control_wrap_extension.rb
|