ProMotion 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -5
- data/lib/ProMotion.rb +1 -0
- data/lib/ProMotion/delegate/delegate_module.rb +1 -1
- data/lib/ProMotion/screen/screen_module.rb +1 -1
- data/lib/ProMotion/screen/screen_navigation.rb +4 -1
- data/lib/ProMotion/styling/styling.rb +4 -1
- data/lib/ProMotion/table/cell/table_view_cell_module.rb +3 -0
- data/lib/ProMotion/table/extensions/searchable.rb +4 -0
- data/lib/ProMotion/table/table.rb +2 -2
- data/lib/ProMotion/tabs/tabs.rb +2 -1
- data/lib/ProMotion/version.rb +1 -1
- data/spec/functional/func_screen_spec.rb +13 -92
- data/spec/functional/func_split_screen_spec.rb +2 -2
- data/spec/functional/func_table_screen_spec.rb +49 -49
- data/spec/unit/screen_helpers_spec.rb +15 -0
- data/spec/unit/screen_spec.rb +48 -1
- data/spec/unit/searchable_table_spec.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c43b2e73403d46846ef391c38eff15acd4239324
|
4
|
+
data.tar.gz: aa5c91f5332d8764690dd8de33c0bc4c0f59ef9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d54c1e1f6fc6c2d983505aad1df54faa34d711a3e1662727c396c0ae4b524d40eea5bdcf8b43a82b8287b216d2f3c67d2d92730472a3e9738833a1b338d71b51
|
7
|
+
data.tar.gz: d6cc272e0f8be4c6282c1d5bdf03ec4e42244f0c380802f8dcb144351ae8901be5f80470c765fcc5fec026f1b152f610e5702214b3ea64977c88a2b7f66f3490
|
data/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
[![Stories in Ready](https://badge.waffle.io/clearsightstudio/ProMotion.png?label=ready&title=Ready)](https://waffle.io/clearsightstudio/ProMotion)
|
1
2
|
# ProMotion
|
2
3
|
|
3
|
-
[![Gem Version](https://
|
4
|
-
[![Build Status](https://
|
5
|
-
[![Code Climate](https://
|
6
|
-
[![Dependency Status](https://
|
7
|
-
[![omniref](https://
|
4
|
+
[![Gem Version](https://img.shields.io/gem/v/ProMotion.svg?style=flat)](https://rubygems.org/gems/ProMotion)
|
5
|
+
[![Build Status](https://img.shields.io/travis/clearsightstudio/ProMotion.svg?style=flat)](https://travis-ci.org/clearsightstudio/ProMotion)
|
6
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/clearsightstudio/ProMotion.svg?style=flat)](https://codeclimate.com/github/clearsightstudio/ProMotion)
|
7
|
+
[![Dependency Status](https://img.shields.io/gemnasium/clearsightstudio/ProMotion.svg?style=flat)](https://gemnasium.com/clearsightstudio/ProMotion)
|
8
|
+
[![omniref](https://img.shields.io/badge/omniref-docs-blue.svg?style=flat)](https://www.omniref.com/ruby/gems/ProMotion)
|
8
9
|
|
9
10
|
## iPhone Apps, Ruby-style
|
10
11
|
|
@@ -103,6 +104,14 @@ This release includes several new features and is backwards compatible with all
|
|
103
104
|
* Added `on_load` and `on_styled` hooks for UIViews that implement those methods ([Jamon Holmgren](https://github.com/clearsightstudio/ProMotion/pull/567))
|
104
105
|
* Fixed an issue where cell properties would be applied twice unnecessarily ([Jamon Holmgren](https://github.com/clearsightstudio/ProMotion/pull/573))
|
105
106
|
|
107
|
+
# Apps built on ProMotion
|
108
|
+
|
109
|
+
[Apps built on ProMotion](https://github.com/clearsightstudio/ProMotion/wiki/Apps-built-on-ProMotion)
|
110
|
+
|
111
|
+
##Your app
|
112
|
+
|
113
|
+
Tweet [@jamonholmgren](https://twitter.com/jamonholmgren) if you built an app in ProMotion and want it included!
|
114
|
+
|
106
115
|
# API Reference
|
107
116
|
|
108
117
|
We've created a comprehensive and always updated wiki with code examples, usage examples, and API reference.
|
data/lib/ProMotion.rb
CHANGED
@@ -12,6 +12,7 @@ Motion::Project::App.setup do |app|
|
|
12
12
|
|
13
13
|
# For compatibility with libraries that don't use detect_dependencies. :-(
|
14
14
|
app.files_dependencies({
|
15
|
+
"#{core_lib}/version.rb" => [ "#{core_lib}/pro_motion.rb" ],
|
15
16
|
"#{core_lib}/cocoatouch/table_view_cell.rb" => [ "#{core_lib}/table/cell/table_view_cell_module.rb" ],
|
16
17
|
"#{core_lib}/table/cell/table_view_cell_module.rb" => [ "#{core_lib}/styling/styling.rb" ],
|
17
18
|
"#{core_lib}/delegate/delegate.rb" => [ "#{core_lib}/delegate/delegate_parent.rb" ],
|
@@ -97,7 +97,7 @@ module ProMotion
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def apply_status_bar
|
100
|
-
@status_bar_visible
|
100
|
+
@status_bar_visible = true if @status_bar_visible.nil?
|
101
101
|
@status_bar_opts ||= { animation: :none }
|
102
102
|
UIApplication.sharedApplication.setStatusBarHidden(!@status_bar_visible, withAnimation:status_bar_animation(@status_bar_opts[:animation]))
|
103
103
|
end
|
@@ -14,8 +14,8 @@ module ProMotion
|
|
14
14
|
apply_properties(args)
|
15
15
|
add_nav_bar(args) if args[:nav_bar]
|
16
16
|
tab_bar_setup
|
17
|
-
try :screen_setup
|
18
17
|
try :on_init
|
18
|
+
try :screen_setup
|
19
19
|
PM.logger.deprecated "In #{self.class.to_s}, #on_create has been deprecated and removed. Use #screen_init instead." if respond_to?(:on_create)
|
20
20
|
end
|
21
21
|
|
@@ -61,12 +61,15 @@ module ProMotion
|
|
61
61
|
alias :close :close_screen
|
62
62
|
|
63
63
|
def send_on_return(args = {})
|
64
|
-
|
64
|
+
return unless self.parent_screen
|
65
|
+
if self.parent_screen.respond_to?(:on_return)
|
65
66
|
if args && self.parent_screen.method(:on_return).arity != 0
|
66
67
|
self.parent_screen.send(:on_return, args)
|
67
68
|
else
|
68
69
|
self.parent_screen.send(:on_return)
|
69
70
|
end
|
71
|
+
elsif self.parent_screen.private_methods.include?(:on_return)
|
72
|
+
PM.logger.warn "#{self.parent_screen.inspect} has an `on_return` method, but it is private and not callable from the closing screen."
|
70
73
|
end
|
71
74
|
end
|
72
75
|
|
@@ -2,7 +2,10 @@ module ProMotion
|
|
2
2
|
module Styling
|
3
3
|
def set_attributes(element, args = {})
|
4
4
|
args = get_attributes_from_symbol(args)
|
5
|
-
|
5
|
+
ignore_keys = [:transition_style, :presentation_style]
|
6
|
+
args.each do |k, v|
|
7
|
+
set_attribute(element, k, v) unless ignore_keys.include?(k)
|
8
|
+
end
|
6
9
|
element.send(:on_styled) if element.respond_to?(:on_styled)
|
7
10
|
element
|
8
11
|
end
|
@@ -73,6 +73,9 @@ module ProMotion
|
|
73
73
|
if data_cell[:accessory][:view] == :switch
|
74
74
|
self.accessoryView = switch_view
|
75
75
|
else
|
76
|
+
if data_cell[:accessory][:view].superview && data_cell[:accessory][:view].superview.is_a?(UITableViewCell)
|
77
|
+
data_cell[:accessory][:view].superview.accessoryView = nil # Fix for issue #586
|
78
|
+
end
|
76
79
|
self.accessoryView = data_cell[:accessory][:view]
|
77
80
|
self.accessoryView.autoresizingMask = UIViewAutoresizingFlexibleWidth
|
78
81
|
end
|
@@ -57,6 +57,10 @@ module ProMotion
|
|
57
57
|
self.table_view.setScrollEnabled false
|
58
58
|
@table_search_display_controller.delegate.will_begin_search if @table_search_display_controller.delegate.respond_to? "will_begin_search"
|
59
59
|
end
|
60
|
+
|
61
|
+
def searchDisplayController(controller, didLoadSearchResultsTableView: tableView)
|
62
|
+
tableView.rowHeight = self.table_view.rowHeight
|
63
|
+
end
|
60
64
|
end
|
61
65
|
end
|
62
66
|
end
|
@@ -136,9 +136,10 @@ module ProMotion
|
|
136
136
|
new_cell.extend(PM::TableViewCellModule) unless new_cell.is_a?(PM::TableViewCellModule)
|
137
137
|
new_cell.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin
|
138
138
|
new_cell.clipsToBounds = true # fix for changed default in 7.1
|
139
|
-
new_cell.setup(data_cell, self)
|
140
139
|
new_cell
|
141
140
|
end
|
141
|
+
|
142
|
+
table_cell.setup(data_cell, self) if table_cell.respond_to?(:setup)
|
142
143
|
table_cell.send(:on_reuse) if !new_cell && table_cell.respond_to?(:on_reuse)
|
143
144
|
table_cell
|
144
145
|
end
|
@@ -196,7 +197,6 @@ module ProMotion
|
|
196
197
|
|
197
198
|
def tableView(table_view, willDisplayCell: table_cell, forRowAtIndexPath: index_path)
|
198
199
|
data_cell = self.promotion_table_data.cell(index_path: index_path)
|
199
|
-
table_cell.setup(data_cell, self) if table_cell.respond_to?(:setup)
|
200
200
|
table_cell.send(:will_display) if table_cell.respond_to?(:will_display)
|
201
201
|
table_cell.send(:restyle!) if table_cell.respond_to?(:restyle!) # Teacup compatibility
|
202
202
|
end
|
data/lib/ProMotion/tabs/tabs.rb
CHANGED
@@ -41,7 +41,8 @@ module ProMotion
|
|
41
41
|
item = UITabBarItem.alloc.initWithTitle(title, image: item_image, tag: tag)
|
42
42
|
|
43
43
|
if item_selected || item_unselected
|
44
|
-
item.
|
44
|
+
item.image = item_unselected
|
45
|
+
item.selectedImage = item_selected
|
45
46
|
end
|
46
47
|
|
47
48
|
item
|
data/lib/ProMotion/version.rb
CHANGED
@@ -10,66 +10,6 @@ describe "ProMotion::Screen functionality" do
|
|
10
10
|
@controller.navigationController
|
11
11
|
end
|
12
12
|
|
13
|
-
it "should have a navigation bar" do
|
14
|
-
wait 0.5 do
|
15
|
-
view("Functional").should.be.kind_of UINavigationItemView
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should allow a string title" do
|
20
|
-
views(UINavigationItemView).include?(UIImageView).should.not.be.true
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should allow setting a left nav bar button" do
|
24
|
-
@controller.set_nav_bar_button :left, title: "Cool", action: :triggered_button
|
25
|
-
tap("Cool")
|
26
|
-
@controller.button_was_triggered.should.be.true
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should allow setting a right nav bar button" do
|
30
|
-
@controller.set_nav_bar_button :right, title: "Cool2", action: :triggered_button
|
31
|
-
tap("Cool2")
|
32
|
-
@controller.button_was_triggered.should.be.true
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should allow opening another screen in the same nav bar and have a back button that is operational" do
|
36
|
-
@controller.open BasicScreen
|
37
|
-
|
38
|
-
wait 0.5 do
|
39
|
-
|
40
|
-
view("Basic").should.be.kind_of UINavigationItemView
|
41
|
-
view("Functional").should.be.kind_of UINavigationItemButtonView
|
42
|
-
|
43
|
-
tap("Functional")
|
44
|
-
wait 0.5 do
|
45
|
-
view("Functional").should.be.kind_of UINavigationItemView
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should push another screen with animation by default" do
|
53
|
-
basic = @controller.open BasicScreen
|
54
|
-
wait 0.5 do
|
55
|
-
basic.animation_ts.should.be > 0.2
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should push another screen with animation when animated: true" do
|
60
|
-
basic = @controller.open BasicScreen, animated: true
|
61
|
-
wait 0.5 do
|
62
|
-
basic.animation_ts.should.be > 0.2
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should push another screen without animation when animated: false" do
|
67
|
-
basic = @controller.open BasicScreen, animated: false
|
68
|
-
wait 0.5 do
|
69
|
-
basic.animation_ts.should.be < 0.2
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
13
|
it "should call the on_back method on the root controller when navigating back" do
|
74
14
|
presented_screen = PresentScreen.new
|
75
15
|
@controller.open presented_screen, animated: false
|
@@ -89,29 +29,11 @@ describe "ProMotion::Screen functionality" do
|
|
89
29
|
@controller.on_back_fired.should == true
|
90
30
|
end
|
91
31
|
|
92
|
-
it "should allow opening and closing a modal screen" do
|
93
|
-
@basic = BasicScreen.new(nav_bar: true)
|
94
|
-
wait 0.1 do
|
95
|
-
@controller.open_modal @basic
|
96
|
-
|
97
|
-
wait 0.6 do
|
98
|
-
|
99
|
-
view("Basic").should.be.kind_of UINavigationItemView
|
100
|
-
@basic.close
|
101
|
-
|
102
|
-
wait 0.6 do
|
103
|
-
@basic = nil
|
104
|
-
view("Functional").should.be.kind_of UINavigationItemView
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
32
|
it "should fire the will_present, on_present, will_dismiss, and on_dismiss_methods" do
|
112
33
|
@presented_screen = PresentScreen.new
|
113
|
-
@controller.open @presented_screen
|
114
|
-
|
34
|
+
@controller.open @presented_screen, animated: false
|
35
|
+
|
36
|
+
wait 0.01 do
|
115
37
|
@presented_screen.will_present_fired.should == true
|
116
38
|
@presented_screen.on_present_fired.should == true
|
117
39
|
|
@@ -119,9 +41,9 @@ describe "ProMotion::Screen functionality" do
|
|
119
41
|
@presented_screen.on_dismiss_fired.should.not == true
|
120
42
|
|
121
43
|
@presented_screen.reset
|
44
|
+
@presented_screen.close animated: false
|
122
45
|
|
123
|
-
|
124
|
-
wait 0.6 do
|
46
|
+
wait 0.01 do
|
125
47
|
@presented_screen.will_dismiss_fired.should == true
|
126
48
|
@presented_screen.on_dismiss_fired.should == true
|
127
49
|
|
@@ -136,15 +58,15 @@ describe "ProMotion::Screen functionality" do
|
|
136
58
|
it "should pop to the root view controller" do
|
137
59
|
@root_vc = @controller.navigationController.visibleViewController
|
138
60
|
@controller.navigationController.viewControllers.count.should == 1
|
139
|
-
@controller.open BasicScreen.new
|
140
|
-
wait 0.
|
141
|
-
@controller.open BasicScreen.new
|
142
|
-
wait 0.
|
143
|
-
@controller.open BasicScreen.new
|
144
|
-
wait 0.
|
61
|
+
@controller.open BasicScreen.new, animated: false
|
62
|
+
wait 0.01 do
|
63
|
+
@controller.open BasicScreen.new, animated: false
|
64
|
+
wait 0.01 do
|
65
|
+
@controller.open BasicScreen.new, animated: false
|
66
|
+
wait 0.01 do
|
145
67
|
@controller.navigationController.viewControllers.count.should == 4
|
146
|
-
@controller.close to_screen: :root
|
147
|
-
wait 0.
|
68
|
+
@controller.close to_screen: :root, animated: false
|
69
|
+
wait 0.01 do
|
148
70
|
@controller.navigationController.viewControllers.count.should == 1
|
149
71
|
@controller.navigationController.topViewController.should == @root_vc
|
150
72
|
end
|
@@ -152,5 +74,4 @@ describe "ProMotion::Screen functionality" do
|
|
152
74
|
end
|
153
75
|
end
|
154
76
|
end
|
155
|
-
|
156
77
|
end
|
@@ -57,7 +57,7 @@ describe "Split screen functionality" do
|
|
57
57
|
|
58
58
|
end
|
59
59
|
|
60
|
-
unless ENV['
|
60
|
+
unless ENV['TRAVIS'] # TODO: Why won't Travis pass these tests??
|
61
61
|
it "should override the title on the button" do
|
62
62
|
rotate_device to: :portrait, button: :bottom
|
63
63
|
|
@@ -69,7 +69,7 @@ describe "Split screen functionality" do
|
|
69
69
|
it "should override the default swipe action, that reveals the menu" do
|
70
70
|
rotate_device to: :portrait, button: :bottom
|
71
71
|
|
72
|
-
@alt_controller = @app.open_split_screen @master, @detail, swipe: false
|
72
|
+
@alt_controller = @app.open_split_screen @master, @detail, swipe: false, animated: false
|
73
73
|
@app.home_screen.presentsWithGesture.should == false
|
74
74
|
end
|
75
75
|
end
|
@@ -24,22 +24,22 @@ describe "ProMotion::TableScreen functionality" do
|
|
24
24
|
table_screen.navigationController.should.be.kind_of(UINavigationController)
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
tap
|
29
|
-
|
30
|
-
|
27
|
+
unless ENV['TRAVIS']
|
28
|
+
it "should increment the tap counter on tap" do
|
29
|
+
tap("Increment")
|
30
|
+
table_screen.tap_counter.should == 3
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
it "should add a new table cell on tap" do
|
34
|
+
tap("Add New Row")
|
35
|
+
view("Dynamically Added").class.to_s.should == table_label_class
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
it "should do nothing when no action specified" do
|
39
|
+
tap("Just another blank row")
|
40
|
+
table_screen.should == table_screen
|
41
|
+
end
|
41
42
|
|
42
|
-
unless ENV['TRAVIS_CI']
|
43
43
|
it "should increment the tap counter by one on tap" do
|
44
44
|
tap("Increment One")
|
45
45
|
table_screen.tap_counter.should == 1
|
@@ -48,53 +48,53 @@ describe "ProMotion::TableScreen functionality" do
|
|
48
48
|
it "should delete the specified row from the table view on tap" do
|
49
49
|
table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 7
|
50
50
|
tap("Delete the row below")
|
51
|
-
wait 0.
|
51
|
+
wait 0.01 do
|
52
52
|
table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 6
|
53
53
|
end
|
54
54
|
end
|
55
|
-
end
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
it "should delete the specified row from the table view on tap with an animation" do
|
57
|
+
table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 7
|
58
|
+
tap("Delete the row below with an animation")
|
59
|
+
wait 0.01 do
|
60
|
+
table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 6
|
61
|
+
end
|
62
62
|
end
|
63
|
-
end
|
64
63
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
64
|
+
# TODO: Why is it so complicated to find the delete button??
|
65
|
+
it "should use editing_style to delete the table row" do
|
66
|
+
table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 7
|
67
|
+
table_screen.cell_was_deleted.should != true
|
68
|
+
flick("Just another deletable blank row", to: :left)
|
69
|
+
|
70
|
+
wait 0.01 do
|
71
|
+
# Tap the delete button
|
72
|
+
view('Just another deletable blank row').superview.superview.subviews.each do |subview|
|
73
|
+
if subview.class.to_s == confirmation_class
|
74
|
+
tap subview
|
75
|
+
wait 0.01 do
|
76
|
+
table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 6
|
77
|
+
table_screen.cell_was_deleted.should == true
|
78
|
+
end
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
83
|
-
end
|
84
83
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
84
|
+
it "should not allow deleting if on_cell_delete returns `false`" do
|
85
|
+
table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 7
|
86
|
+
table_screen.cell_was_deleted.should != true
|
87
|
+
flick("A non-deletable blank row", to: :left)
|
88
|
+
|
89
|
+
wait 0.01 do
|
90
|
+
# Tap the delete button
|
91
|
+
view('A non-deletable blank row').superview.superview.subviews.each do |subview|
|
92
|
+
if subview.class == confirmation_class
|
93
|
+
tap subview
|
94
|
+
wait 0.01 do
|
95
|
+
table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 7
|
96
|
+
table_screen.cell_was_deleted.should != false
|
97
|
+
end
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
@@ -288,6 +288,21 @@ describe "screen helpers" do
|
|
288
288
|
@screen.send_on_return key: :value
|
289
289
|
end
|
290
290
|
|
291
|
+
# Regression test: https://github.com/clearsightstudio/ProMotion/issues/635
|
292
|
+
context "when both screens have nav_bar: true" do
|
293
|
+
it "#close_modal_screen should still call #send_on_return" do
|
294
|
+
parent_screen = HomeScreen.new(nav_bar: true)
|
295
|
+
child_screen = BasicScreen.new(nav_bar: true)
|
296
|
+
|
297
|
+
parent_screen.mock!(:on_return) do |args|
|
298
|
+
args[:name].should == "Kevin VanGelder"
|
299
|
+
end
|
300
|
+
|
301
|
+
parent_screen.open(child_screen, animated: false)
|
302
|
+
child_screen.close(animated: false, name: "Kevin VanGelder")
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
291
306
|
context "there are two parent screens and we're closing to the first" do
|
292
307
|
it "#send_on_return should pass args to the first screen" do
|
293
308
|
first_screen = HomeScreen.new(nav_bar: true)
|
data/spec/unit/screen_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe "screen properties" do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should store title" do
|
10
|
-
HomeScreen.title.should ==
|
10
|
+
HomeScreen.title.should == "Home"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should set default title on new instances" do
|
@@ -74,6 +74,42 @@ describe "screen properties" do
|
|
74
74
|
@screen.should_autorotate.should == true
|
75
75
|
end
|
76
76
|
|
77
|
+
it "should allow opening and closing a modal screen" do
|
78
|
+
parent_screen = BasicScreen.new(nav_bar: true)
|
79
|
+
parent_screen.mock!(:"presentViewController:animated:completion:") do |controller, animated, completion|
|
80
|
+
controller.should == @screen.navigationController
|
81
|
+
end
|
82
|
+
parent_screen.open_modal @screen
|
83
|
+
parent_screen.mock!(:"dismissViewControllerAnimated:completion:") do |animated, completion|
|
84
|
+
animated.should == true
|
85
|
+
end
|
86
|
+
@screen.close
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should push another screen with animation by default" do
|
90
|
+
parent_screen = BasicScreen.new(nav_bar: true)
|
91
|
+
parent_screen.navigationController.mock!(:"pushViewController:animated:") do |controller, animated|
|
92
|
+
animated.should == true
|
93
|
+
end
|
94
|
+
parent_screen.open @screen
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should push another screen with animation when animated: true" do
|
98
|
+
parent_screen = BasicScreen.new(nav_bar: true)
|
99
|
+
parent_screen.navigationController.mock!(:"pushViewController:animated:") do |controller, animated|
|
100
|
+
animated.should == true
|
101
|
+
end
|
102
|
+
parent_screen.open @screen, animated: true
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should push another screen without animation when animated: false" do
|
106
|
+
parent_screen = BasicScreen.new(nav_bar: true)
|
107
|
+
parent_screen.navigationController.mock!(:"pushViewController:animated:") do |controller, animated|
|
108
|
+
animated.should == false
|
109
|
+
end
|
110
|
+
parent_screen.open @screen, animated: false
|
111
|
+
end
|
112
|
+
|
77
113
|
# Issue https://github.com/clearsightstudio/ProMotion/issues/109
|
78
114
|
it "#should_autorotate should fire when shouldAutorotate fires when in a navigation bar" do
|
79
115
|
parent_screen = BasicScreen.new(nav_bar: true)
|
@@ -153,6 +189,10 @@ describe "screen properties" do
|
|
153
189
|
|
154
190
|
describe "navigation controller behavior" do
|
155
191
|
|
192
|
+
it "should have a navigation bar" do
|
193
|
+
@screen.navigationController.should.be.kind_of UINavigationController
|
194
|
+
end
|
195
|
+
|
156
196
|
it "should let the instance set the nav_controller" do
|
157
197
|
screen = HomeScreen.new nav_bar: true, nav_controller: CustomNavigationController
|
158
198
|
screen.on_load
|
@@ -175,6 +215,13 @@ describe "screen properties" do
|
|
175
215
|
@screen.navigationItem.leftBarButtonItem.should.not == nil
|
176
216
|
end
|
177
217
|
|
218
|
+
it "should set the given action on a left bar button item" do
|
219
|
+
@screen.navigationItem.leftBarButtonItem.action.should == :save_something
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should set the given action on a right bar button item" do
|
223
|
+
@screen.navigationItem.rightBarButtonItem.action.should == :return_to_some_other_screen
|
224
|
+
end
|
178
225
|
end
|
179
226
|
|
180
227
|
describe "bar button behavior" do
|
@@ -52,4 +52,10 @@ describe "Searchable table spec" do
|
|
52
52
|
controller.will_end_search_called.should == true
|
53
53
|
end
|
54
54
|
|
55
|
+
it "should set the row height of the search display to match the source table row height" do
|
56
|
+
tableView = UITableView.alloc.init
|
57
|
+
tableView.mock!(:rowHeight=)
|
58
|
+
controller.searchDisplayController(controller, didLoadSearchResultsTableView: tableView)
|
59
|
+
end
|
60
|
+
|
55
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ProMotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamon Holmgren
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: methadone
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.4.
|
184
|
+
rubygems_version: 2.4.6
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: ProMotion is a fast way to get started building RubyMotion apps. Instead
|