formotion 1.3.1 → 1.4.0

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.
Files changed (47) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +1 -0
  3. data/Formotion.gemspec +1 -1
  4. data/LIST_OF_ROW_TYPES.md +115 -3
  5. data/README.md +1 -0
  6. data/examples/KitchenSink/app/app_delegate.rb +16 -2
  7. data/lib/formotion.rb +9 -1
  8. data/lib/formotion/form/form.rb +7 -0
  9. data/lib/formotion/form/form_delegate.rb +2 -2
  10. data/lib/formotion/patch/ui_image.rb +45 -0
  11. data/lib/formotion/patch/ui_text_view_placeholder.rb +4 -1
  12. data/lib/formotion/row/row.rb +13 -1
  13. data/lib/formotion/row_type/base.rb +13 -4
  14. data/lib/formotion/row_type/button.rb +1 -0
  15. data/lib/formotion/row_type/check_row.rb +2 -1
  16. data/lib/formotion/row_type/date_row.rb +3 -0
  17. data/lib/formotion/row_type/image_row.rb +6 -1
  18. data/lib/formotion/row_type/map_row.rb +79 -0
  19. data/lib/formotion/row_type/multi_choice_row.rb +25 -0
  20. data/lib/formotion/row_type/object_row.rb +30 -0
  21. data/lib/formotion/row_type/options_row.rb +2 -2
  22. data/lib/formotion/row_type/paged_image_row.rb +257 -0
  23. data/lib/formotion/row_type/picker_row.rb +2 -0
  24. data/lib/formotion/row_type/slider_row.rb +2 -2
  25. data/lib/formotion/row_type/static_row.rb +1 -1
  26. data/lib/formotion/row_type/string_row.rb +3 -7
  27. data/lib/formotion/row_type/subform_row.rb +3 -1
  28. data/lib/formotion/row_type/switch_row.rb +2 -2
  29. data/lib/formotion/row_type/tags_row.rb +172 -0
  30. data/lib/formotion/row_type/template_row.rb +3 -3
  31. data/lib/formotion/row_type/text_row.rb +5 -1
  32. data/lib/formotion/row_type/web_view_row.rb +44 -0
  33. data/lib/formotion/version.rb +1 -1
  34. data/resources/tags_row-selected.png +0 -0
  35. data/resources/tags_row-selected@2x.png +0 -0
  36. data/resources/tags_row.png +0 -0
  37. data/resources/tags_row@2x.png +0 -0
  38. data/spec/form_spec.rb +26 -0
  39. data/spec/functional/date_row_spec.rb +6 -0
  40. data/spec/functional/picker_row_spec.rb +5 -0
  41. data/spec/row_type/back_spec.rb +1 -1
  42. data/spec/row_type/base_spec.rb +3 -3
  43. data/spec/row_type/string_spec.rb +14 -3
  44. data/spec/row_type/subform_spec.rb +1 -1
  45. data/spec/row_type/submit_spec.rb +1 -1
  46. data/spec/row_type/text_spec.rb +7 -0
  47. metadata +17 -6
@@ -36,6 +36,13 @@ describe "String Row Type" do
36
36
  @row.value.should == "other value"
37
37
  end
38
38
 
39
+ it "should use custom font" do
40
+ huge_non_default_font = UIFont.boldSystemFontOfSize(20)
41
+ @row.font = huge_non_default_font
42
+ cell = @row.make_cell
43
+ @row.text_field.font.should == huge_non_default_font
44
+ end
45
+
39
46
  # Placeholder
40
47
  it "should have no placeholder by default" do
41
48
  cell = @row.make_cell
@@ -59,22 +66,26 @@ describe "String Row Type" do
59
66
  it "should call _on_select" do
60
67
  @row.object.instance_variable_set("@called_on_select", false)
61
68
  def (@row.object)._on_select(a, b); @called_on_select = true end
62
- @row.object.on_select(nil, nil)
69
+ @row.object._on_select(nil, nil)
63
70
  @row.object.instance_variable_get("@called_on_select").should == true
64
71
  end
65
72
 
66
73
  describe "when on_tap callback is set" do
67
74
  tests_row :string do |row|
68
75
  @on_tap_called = false
76
+ row.instance_variable_set("@text_field", Object.new.tap { |o|
77
+ def o.becomeFirstResponder
78
+ end
79
+ })
69
80
  row.on_tap { |row| @on_tap_called = true }
70
81
  end
71
82
 
72
83
  it "should return true" do
73
- @row.object.on_select(nil, nil).should == true
84
+ @row.object._on_select(nil, nil).should == true
74
85
  end
75
86
 
76
87
  it "should call the callback" do
77
- @row.object.on_select(nil, nil)
88
+ @row.object._on_select(nil, nil)
78
89
  @on_tap_called.should == true
79
90
  end
80
91
 
@@ -23,7 +23,7 @@ describe "Subform Row" do
23
23
  form = FakeForm.new
24
24
  @row.instance_variable_set("@section", form)
25
25
 
26
- @row.object.on_select(nil, nil)
26
+ @row.object._on_select(nil, nil)
27
27
  form.controller.push_subform_called.should == true
28
28
  end
29
29
  end
@@ -7,7 +7,7 @@ describe "Submit Row" do
7
7
 
8
8
  it "should submit on select" do
9
9
  fake_delegate = FakeDelegateClass.new
10
- @row.object.on_select(nil, fake_delegate)
10
+ @row.object._on_select(nil, fake_delegate)
11
11
  fake_delegate.submit_called.should == true
12
12
  end
13
13
  end
@@ -26,6 +26,13 @@ describe "Text Row" do
26
26
  @row.text_field.text.should == 'new value'
27
27
  end
28
28
 
29
+ it "should use custom font" do
30
+ huge_non_default_font = UIFont.boldSystemFontOfSize(20)
31
+ @row.font = huge_non_default_font
32
+ cell = @row.make_cell
33
+ @row.text_field.font.should == huge_non_default_font
34
+ end
35
+
29
36
  # Placeholder
30
37
  it "should have no placeholder by default" do
31
38
  cell = @row.make_cell
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formotion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clay Allsopp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-15 00:00:00.000000000 Z
11
+ date: 2013-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bubble-wrap
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.4
19
+ version: 1.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.4
26
+ version: 1.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: motion-require
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -127,6 +127,7 @@ files:
127
127
  - lib/formotion/model/formable.rb
128
128
  - lib/formotion/patch/object.rb
129
129
  - lib/formotion/patch/ui_action_sheet.rb
130
+ - lib/formotion/patch/ui_image.rb
130
131
  - lib/formotion/patch/ui_text_field.rb
131
132
  - lib/formotion/patch/ui_text_view.rb
132
133
  - lib/formotion/patch/ui_text_view_placeholder.rb
@@ -142,8 +143,12 @@ files:
142
143
  - lib/formotion/row_type/email_row.rb
143
144
  - lib/formotion/row_type/image_row.rb
144
145
  - lib/formotion/row_type/items_mapper.rb
146
+ - lib/formotion/row_type/map_row.rb
147
+ - lib/formotion/row_type/multi_choice_row.rb
145
148
  - lib/formotion/row_type/number_row.rb
149
+ - lib/formotion/row_type/object_row.rb
146
150
  - lib/formotion/row_type/options_row.rb
151
+ - lib/formotion/row_type/paged_image_row.rb
147
152
  - lib/formotion/row_type/phone_row.rb
148
153
  - lib/formotion/row_type/picker_row.rb
149
154
  - lib/formotion/row_type/row_type.rb
@@ -153,10 +158,16 @@ files:
153
158
  - lib/formotion/row_type/subform_row.rb
154
159
  - lib/formotion/row_type/submit_row.rb
155
160
  - lib/formotion/row_type/switch_row.rb
161
+ - lib/formotion/row_type/tags_row.rb
156
162
  - lib/formotion/row_type/template_row.rb
157
163
  - lib/formotion/row_type/text_row.rb
164
+ - lib/formotion/row_type/web_view_row.rb
158
165
  - lib/formotion/section/section.rb
159
166
  - lib/formotion/version.rb
167
+ - resources/tags_row-selected.png
168
+ - resources/tags_row-selected@2x.png
169
+ - resources/tags_row.png
170
+ - resources/tags_row@2x.png
160
171
  - spec/form/persist_spec.rb
161
172
  - spec/form_spec.rb
162
173
  - spec/formable/kvo_spec.rb