ProMotion 1.2.1 → 2.0.0.rc1
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/README.md +36 -10
- data/lib/ProMotion.rb +11 -2
- data/lib/ProMotion/cocoatouch/ns_string.rb +5 -0
- data/lib/ProMotion/cocoatouch/ns_url.rb +5 -0
- data/lib/ProMotion/cocoatouch/tab_bar_controller.rb +5 -7
- data/lib/ProMotion/cocoatouch/table_view_cell.rb +0 -16
- data/lib/ProMotion/cocoatouch/table_view_controller.rb +2 -3
- data/lib/ProMotion/cocoatouch/view_controller.rb +3 -6
- data/lib/ProMotion/delegate/delegate.rb +0 -3
- data/lib/ProMotion/delegate/delegate_module.rb +24 -20
- data/lib/ProMotion/{containers → ipad}/split_screen.rb +30 -32
- data/lib/ProMotion/{logger.rb → logger/logger.rb} +6 -5
- data/lib/ProMotion/screen/nav_bar_module.rb +126 -0
- data/lib/ProMotion/screen/screen.rb +0 -3
- data/lib/ProMotion/screen/screen_module.rb +54 -177
- data/lib/ProMotion/screen/screen_navigation.rb +29 -40
- data/lib/ProMotion/{view → styling}/styling.rb +17 -47
- data/lib/ProMotion/table/cell/table_view_cell_module.rb +76 -123
- data/lib/ProMotion/table/data/table_data.rb +1 -1
- data/lib/ProMotion/table/extensions/longpressable.rb +24 -0
- data/lib/ProMotion/table/extensions/refreshable.rb +1 -0
- data/lib/ProMotion/table/grouped_table_screen.rb +0 -5
- data/lib/ProMotion/table/table.rb +63 -83
- data/lib/ProMotion/table/table_screen.rb +0 -4
- data/lib/ProMotion/{containers → tabs}/tabs.rb +20 -21
- data/lib/ProMotion/version.rb +1 -1
- data/lib/ProMotion/web/web_screen.rb +0 -4
- data/lib/ProMotion/web/web_screen_module.rb +8 -5
- data/spec/functional/func_screen_spec.rb +14 -18
- data/spec/functional/func_split_screen_spec.rb +2 -2
- data/spec/functional/func_table_screen_spec.rb +54 -40
- data/spec/functional/func_web_screen_spec.rb +12 -17
- data/spec/helpers/test_helper.rb +27 -0
- data/spec/unit/delegate_spec.rb +4 -67
- data/spec/unit/image_title_screen.rb +9 -0
- data/spec/unit/image_view_title_screen.rb +9 -0
- data/spec/unit/load_view_spec.rb +27 -0
- data/spec/unit/main_spec.rb +0 -6
- data/spec/unit/screen_helpers_spec.rb +23 -17
- data/spec/unit/screen_spec.rb +21 -17
- data/spec/unit/searchable_table_spec.rb +55 -0
- data/spec/unit/split_screen_in_tab_bar_spec.rb +5 -5
- data/spec/unit/split_screen_spec.rb +4 -4
- data/spec/unit/tab_bar_spec.rb +79 -0
- data/spec/unit/tab_spec.rb +11 -5
- data/spec/unit/tables/table_module_spec.rb +22 -8
- data/spec/unit/tables/table_screen_spec.rb +1 -1
- data/spec/unit/tables/table_view_cell_spec.rb +16 -16
- data/spec/unit/view_helper_spec.rb +6 -81
- data/spec/unit/view_title_screen.rb +10 -0
- data/spec/unit/web_spec.rb +31 -37
- metadata +37 -111
- data/.gitignore +0 -33
- data/.travis.yml +0 -4
- data/CONTRIBUTING.md +0 -20
- data/Gemfile +0 -5
- data/LICENSE +0 -22
- data/ProMotion.gemspec +0 -30
- data/Rakefile +0 -66
- data/app/app_delegate.rb +0 -7
- data/app/screens/basic_screen.rb +0 -15
- data/lib/ProMotion/delegate/delegate_notifications.rb +0 -70
- data/lib/ProMotion/extensions/conversions.rb +0 -20
- data/lib/ProMotion/map/map_screen.rb +0 -10
- data/lib/ProMotion/map/map_screen_annotation.rb +0 -65
- data/lib/ProMotion/map/map_screen_module.rb +0 -212
- data/lib/ProMotion/push_notification/push_notification.rb +0 -58
- data/resources/WebScreen.html +0 -6
- data/resources/list.png +0 -0
- data/resources/test.png +0 -0
- data/spec/functional/func_image_title_screen.rb +0 -20
- data/spec/functional/func_image_view_title_screen.rb +0 -20
- data/spec/functional/func_map_screen_spec.rb +0 -162
- data/spec/functional/func_searchable_table_spec.rb +0 -56
- data/spec/functional/func_tab_bar_spec.rb +0 -78
- data/spec/functional/func_view_title_screen.rb +0 -21
- data/spec/helpers/basic_screen.rb +0 -3
- data/spec/helpers/custom_title_view.rb +0 -4
- data/spec/helpers/detail_screen.rb +0 -3
- data/spec/helpers/dummy_class.rb +0 -3
- data/spec/helpers/functional_screen.rb +0 -15
- data/spec/helpers/home_screen.rb +0 -19
- data/spec/helpers/image_title_screen.rb +0 -15
- data/spec/helpers/image_view_title_screen.rb +0 -15
- data/spec/helpers/map_screen.rb +0 -53
- data/spec/helpers/master_screen.rb +0 -3
- data/spec/helpers/present_screen.rb +0 -26
- data/spec/helpers/screen_module_view_controller.rb +0 -55
- data/spec/helpers/tab_screen.rb +0 -4
- data/spec/helpers/table_screen.rb +0 -117
- data/spec/helpers/table_screen_indexable.rb +0 -18
- data/spec/helpers/table_screen_refreshable.rb +0 -11
- data/spec/helpers/table_screen_searchable.rb +0 -72
- data/spec/helpers/test_delegate.rb +0 -34
- data/spec/helpers/test_delegate_colors.rb +0 -17
- data/spec/helpers/view_title_screen.rb +0 -15
- data/spec/helpers/web_screen.rb +0 -23
- data/spec/unit/map_spec.rb +0 -71
data/spec/helpers/test_helper.rb
CHANGED
|
@@ -3,3 +3,30 @@ class TestHelper
|
|
|
3
3
|
UIDevice.currentDevice.systemVersion.to_f >= 7.0
|
|
4
4
|
end
|
|
5
5
|
end
|
|
6
|
+
|
|
7
|
+
def silence_warnings(&block)
|
|
8
|
+
warn_level = $VERBOSE
|
|
9
|
+
$VERBOSE = nil
|
|
10
|
+
begin
|
|
11
|
+
result = block.call
|
|
12
|
+
ensure
|
|
13
|
+
$VERBOSE = warn_level
|
|
14
|
+
end
|
|
15
|
+
result
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
silence_warnings do
|
|
19
|
+
module Bacon
|
|
20
|
+
if ENV['filter']
|
|
21
|
+
$stderr.puts "Filtering specs that match: #{ENV['filter']}"
|
|
22
|
+
RestrictName = Regexp.new(ENV['filter'])
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if ENV['filter_context']
|
|
26
|
+
$stderr.puts "Filtering contexts that match: #{ENV['filter_context']}"
|
|
27
|
+
RestrictContext = Regexp.new(ENV['filter_context'])
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
Backtraces = false if ENV['hide_backtraces']
|
|
31
|
+
end
|
|
32
|
+
end
|
data/spec/unit/delegate_spec.rb
CHANGED
|
@@ -10,69 +10,6 @@ describe "PM::Delegate" do
|
|
|
10
10
|
@subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions:{jamon: true})
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
it "should handle push notifications" do
|
|
14
|
-
|
|
15
|
-
@subject.mock!(:on_push_notification) do |notification, was_launched|
|
|
16
|
-
notification.should.be.kind_of(PM::PushNotification)
|
|
17
|
-
notification.alert.should == "Eating Bacon"
|
|
18
|
-
notification.badge.should == 42
|
|
19
|
-
notification.sound.should == "jamon"
|
|
20
|
-
@subject.aps_notification.should == notification
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
launch_options = { UIApplicationLaunchOptionsRemoteNotificationKey => PM::PushNotification.fake_notification(alert: "Eating Bacon", badge: 42, sound: "jamon").notification }
|
|
24
|
-
@subject.application(UIApplication.sharedApplication, willFinishLaunchingWithOptions: nil)
|
|
25
|
-
@subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions:launch_options )
|
|
26
|
-
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it "should return the registered push notification types as an array" do
|
|
30
|
-
@subject.registered_push_notifications.should == []
|
|
31
|
-
bits = 0
|
|
32
|
-
types = []
|
|
33
|
-
{ badge: UIRemoteNotificationTypeBadge,
|
|
34
|
-
sound: UIRemoteNotificationTypeSound,
|
|
35
|
-
alert: UIRemoteNotificationTypeAlert,
|
|
36
|
-
newsstand: UIRemoteNotificationTypeNewsstandContentAvailability }.each do |symbol, bit|
|
|
37
|
-
UIApplication.sharedApplication.stub!(:enabledRemoteNotificationTypes, return: bit)
|
|
38
|
-
@subject.registered_push_notifications.should == [symbol]
|
|
39
|
-
|
|
40
|
-
bits |= bit
|
|
41
|
-
types << symbol
|
|
42
|
-
UIApplication.sharedApplication.stub!(:enabledRemoteNotificationTypes, return: bits)
|
|
43
|
-
@subject.registered_push_notifications.should == types
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "should return false for was_launched if the app is currently active on screen" do
|
|
48
|
-
@subject.mock!(:on_push_notification) do |notification, was_launched|
|
|
49
|
-
was_launched.should.be.false
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
fake_app = Struct.new(:applicationState).new(UIApplicationStateActive)
|
|
53
|
-
remote_notification = PM::PushNotification.fake_notification.notification
|
|
54
|
-
@subject.application(fake_app, didReceiveRemoteNotification: remote_notification)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it "should return true for was_launched if app was launched from background" do
|
|
58
|
-
@subject.mock!(:on_push_notification) do |notification, was_launched|
|
|
59
|
-
was_launched.should.be.true
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
fake_app = Struct.new(:applicationState).new(UIApplicationStateBackground)
|
|
63
|
-
remote_notification = PM::PushNotification.fake_notification.notification
|
|
64
|
-
@subject.application(fake_app, didReceiveRemoteNotification: remote_notification)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it "should return true for was_launched if the app wasn't running" do
|
|
68
|
-
@subject.mock!(:on_push_notification) do |notification, was_launched|
|
|
69
|
-
was_launched.should.be.true
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
launch_options = { UIApplicationLaunchOptionsRemoteNotificationKey => PM::PushNotification.fake_notification.notification }
|
|
73
|
-
@subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions:launch_options )
|
|
74
|
-
end
|
|
75
|
-
|
|
76
13
|
it "should set home_screen when opening a new screen" do
|
|
77
14
|
@subject.application(UIApplication.sharedApplication, willFinishLaunchingWithOptions: nil)
|
|
78
15
|
@subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions: nil)
|
|
@@ -151,13 +88,13 @@ if TestHelper.ios7
|
|
|
151
88
|
|
|
152
89
|
before do
|
|
153
90
|
@subject = TestDelegateRed.new
|
|
154
|
-
@
|
|
155
|
-
@
|
|
156
|
-
@subject.open @
|
|
91
|
+
@screen = BasicScreen.new nav_bar: true
|
|
92
|
+
@screen.view_will_appear(false)
|
|
93
|
+
@subject.open @screen
|
|
157
94
|
end
|
|
158
95
|
|
|
159
96
|
it 'should set the application tint color on iOS 7' do
|
|
160
|
-
@
|
|
97
|
+
@screen.view.tintColor.should == UIColor.redColor
|
|
161
98
|
end
|
|
162
99
|
|
|
163
100
|
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
describe "load_view and on_load tests" do
|
|
2
|
+
def screen
|
|
3
|
+
@screen ||= LoadViewScreen.new
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def table_screen
|
|
7
|
+
@table_screen ||= LoadViewTableScreen.new
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "should call load_view when requesting the view" do
|
|
11
|
+
screen.view.should.be.kind_of(MyView)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should call on_load after creating the view" do
|
|
15
|
+
screen.view.should.be.kind_of(MyView)
|
|
16
|
+
screen.view.backgroundColor.should == UIColor.redColor
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should call load_view when requesting the view in a table screen" do
|
|
20
|
+
table_screen.view.should.be.kind_of(MyTableView)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "should call on_load after creating the view in a table screen" do
|
|
24
|
+
table_screen.view.should.be.kind_of(MyTableView)
|
|
25
|
+
table_screen.view.backgroundColor.should == UIColor.greenColor
|
|
26
|
+
end
|
|
27
|
+
end
|
data/spec/unit/main_spec.rb
CHANGED
|
@@ -4,10 +4,4 @@ describe "pro motion module" do
|
|
|
4
4
|
should.not.raise(NameError) { PM }
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
it "should not allow screen inclusion into just any class" do
|
|
8
|
-
dummy = DummyClass.new
|
|
9
|
-
dummy.extend ProMotion::ScreenModule
|
|
10
|
-
should.raise(StandardError) { dummy.on_create }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
7
|
end
|
|
@@ -123,7 +123,7 @@ describe "screen helpers" do
|
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
it "should apply properties when opening a new screen" do
|
|
126
|
-
new_screen = @screen.send(:set_up_screen_for_open, BasicScreen, title: 'Some Title', modal: true, hide_tab_bar: true, nav_bar: true)
|
|
126
|
+
new_screen = @screen.send(:set_up_screen_for_open, BasicScreen, { title: 'Some Title', modal: true, hide_tab_bar: true, nav_bar: true })
|
|
127
127
|
|
|
128
128
|
new_screen.parent_screen.should == @screen
|
|
129
129
|
new_screen.title.should == 'Some Title'
|
|
@@ -140,17 +140,9 @@ describe "screen helpers" do
|
|
|
140
140
|
animated.should == true
|
|
141
141
|
completion.should == nil
|
|
142
142
|
end
|
|
143
|
-
@screen.send(:present_modal_view_controller, new_screen, true, nil)
|
|
143
|
+
@screen.send(:present_modal_view_controller, new_screen, { animated: true, completion: nil })
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
-
# it "should push screen onto nav controller stack inside a tab bar" do
|
|
147
|
-
# # TODO: Implement this test
|
|
148
|
-
# end
|
|
149
|
-
|
|
150
|
-
# it "should set the tab bar selectedIndex when opening a screen inside a tab bar" do
|
|
151
|
-
# # TODO: Implement this test
|
|
152
|
-
# end
|
|
153
|
-
|
|
154
146
|
it "should open a root screen if :close_all is provided" do
|
|
155
147
|
@screen.mock!(:open_root_screen) { |screen| screen.should.be.instance_of BasicScreen }
|
|
156
148
|
screen = @screen.open BasicScreen, close_all: true
|
|
@@ -158,20 +150,20 @@ describe "screen helpers" do
|
|
|
158
150
|
end
|
|
159
151
|
|
|
160
152
|
it "should present a modal screen if :modal is provided" do
|
|
161
|
-
@screen.mock!(:present_modal_view_controller) do |screen,
|
|
153
|
+
@screen.mock!(:present_modal_view_controller) do |screen, args|
|
|
162
154
|
screen.should.be.instance_of BasicScreen
|
|
163
|
-
animated.should == true
|
|
164
|
-
completion.should.be.kind_of Proc
|
|
155
|
+
args[:animated].should == true
|
|
156
|
+
args[:completion].should.be.kind_of Proc
|
|
165
157
|
end
|
|
166
158
|
screen = @screen.open BasicScreen, modal: true, completion: lambda{}
|
|
167
159
|
screen.should.be.kind_of BasicScreen
|
|
168
160
|
end
|
|
169
161
|
|
|
170
162
|
it "should present a modal screen if open_modal is used" do
|
|
171
|
-
@screen.mock!(:present_modal_view_controller) do |screen,
|
|
163
|
+
@screen.mock!(:present_modal_view_controller) do |screen, args|
|
|
172
164
|
screen.should.be.instance_of BasicScreen
|
|
173
|
-
animated.should == true
|
|
174
|
-
completion.should == nil
|
|
165
|
+
args[:animated].should == true
|
|
166
|
+
args[:completion].should == nil
|
|
175
167
|
end
|
|
176
168
|
screen = @screen.open_modal BasicScreen
|
|
177
169
|
screen.should.be.kind_of BasicScreen
|
|
@@ -191,7 +183,7 @@ describe "screen helpers" do
|
|
|
191
183
|
|
|
192
184
|
it "should open screen in tab bar if :in_tab is provided" do
|
|
193
185
|
@screen.stub!(:tab_bar, return: true)
|
|
194
|
-
@screen.mock!(:
|
|
186
|
+
@screen.mock!(:open_in_tab) do |screen, tab_name|
|
|
195
187
|
screen.should.be.instance_of BasicScreen
|
|
196
188
|
tab_name.should == 'my_tab'
|
|
197
189
|
end
|
|
@@ -220,6 +212,20 @@ describe "screen helpers" do
|
|
|
220
212
|
screen.should == new_screen
|
|
221
213
|
end
|
|
222
214
|
|
|
215
|
+
it "should not double-open a view controller if it's already been opened" do
|
|
216
|
+
parent_screen = HomeScreen.new(nav_bar: true)
|
|
217
|
+
new_screen = BasicScreen.new
|
|
218
|
+
@pushed = 0
|
|
219
|
+
parent_screen.navigationController.mock!("pushViewController:animated:") do |vc, animated|
|
|
220
|
+
@pushed += 1
|
|
221
|
+
parent_screen.navigationController.stub!("topViewController", return: vc)
|
|
222
|
+
end
|
|
223
|
+
parent_screen.open new_screen
|
|
224
|
+
@pushed.should == 1
|
|
225
|
+
parent_screen.open new_screen
|
|
226
|
+
@pushed.should == 1
|
|
227
|
+
end
|
|
228
|
+
|
|
223
229
|
end
|
|
224
230
|
|
|
225
231
|
|
data/spec/unit/screen_spec.rb
CHANGED
|
@@ -9,7 +9,7 @@ describe "screen properties" do
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
it "should store title" do
|
|
12
|
-
HomeScreen.
|
|
12
|
+
HomeScreen.title.should == 'Home'
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it "should set default title on new instances" do
|
|
@@ -23,33 +23,28 @@ describe "screen properties" do
|
|
|
23
23
|
|
|
24
24
|
it "should not let the instance reset the default title" do
|
|
25
25
|
@screen.title = "instance method"
|
|
26
|
-
HomeScreen.
|
|
26
|
+
HomeScreen.title.should != 'instance method'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
it "should set the tab bar item with a system
|
|
30
|
-
@screen.set_tab_bar_item
|
|
29
|
+
it "should set the tab bar item with a system item" do
|
|
30
|
+
@screen.set_tab_bar_item system_item: :contacts
|
|
31
31
|
comparison = UITabBarItem.alloc.initWithTabBarSystemItem(UITabBarSystemItemContacts, tag: 0)
|
|
32
32
|
@screen.tabBarItem.systemItem.should == comparison.systemItem
|
|
33
33
|
@screen.tabBarItem.tag.should == comparison.tag
|
|
34
34
|
@screen.tabBarItem.image.should == comparison.image
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
it "should set the tab bar item with a custom
|
|
38
|
-
@screen.set_tab_bar_item title: "My Screen",
|
|
37
|
+
it "should set the tab bar item with a custom item and title" do
|
|
38
|
+
@screen.set_tab_bar_item title: "My Screen", item: "list"
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
comparison = UITabBarItem.alloc.initWithTitle("My Screen", image:
|
|
40
|
+
item_image = UIImage.imageNamed("list")
|
|
41
|
+
comparison = UITabBarItem.alloc.initWithTitle("My Screen", image: item_image, tag: 0)
|
|
42
42
|
|
|
43
43
|
@screen.tabBarItem.systemItem.should == comparison.systemItem
|
|
44
44
|
@screen.tabBarItem.tag.should == comparison.tag
|
|
45
45
|
@screen.tabBarItem.image.should == comparison.image
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
it "should store debug mode" do
|
|
49
|
-
HomeScreen.debug_mode = true
|
|
50
|
-
HomeScreen.debug_mode.should == true
|
|
51
|
-
end
|
|
52
|
-
|
|
53
48
|
it "#modal? should be true" do
|
|
54
49
|
@screen.modal?.should == true
|
|
55
50
|
end
|
|
@@ -151,7 +146,7 @@ describe "screen properties" do
|
|
|
151
146
|
describe "bar button behavior" do
|
|
152
147
|
describe "system bar buttons" do
|
|
153
148
|
before do
|
|
154
|
-
@screen.
|
|
149
|
+
@screen.set_nav_bar_button :right, title: nil, action: :add_something, system_item: UIBarButtonSystemItemAdd
|
|
155
150
|
end
|
|
156
151
|
|
|
157
152
|
it "has a right bar button item of the correct type" do
|
|
@@ -163,9 +158,19 @@ describe "screen properties" do
|
|
|
163
158
|
end
|
|
164
159
|
end
|
|
165
160
|
|
|
161
|
+
describe "bar button tint colors" do
|
|
162
|
+
before do
|
|
163
|
+
@screen.set_nav_bar_button :right, title: nil, action: :add_something, system_item: UIBarButtonSystemItemAdd, tint_color: UIColor.blueColor
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
it "sets the tint color" do
|
|
167
|
+
CGColorEqualToColor(@screen.navigationItem.rightBarButtonItem.tintColor, UIColor.blueColor).should == true
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
166
171
|
describe 'titled bar buttons' do
|
|
167
172
|
before do
|
|
168
|
-
@screen.
|
|
173
|
+
@screen.set_nav_bar_button :right, title: "Save", action: :save_something, style: UIBarButtonItemStyleDone
|
|
169
174
|
end
|
|
170
175
|
|
|
171
176
|
it "has a right bar button item of the correct type" do
|
|
@@ -184,7 +189,7 @@ describe "screen properties" do
|
|
|
184
189
|
describe 'image bar buttons' do
|
|
185
190
|
before do
|
|
186
191
|
@image = UIImage.alloc.init
|
|
187
|
-
@screen.
|
|
192
|
+
@screen.set_nav_bar_button :right, title: @image, action: :save_something, style: UIBarButtonItemStyleDone
|
|
188
193
|
end
|
|
189
194
|
|
|
190
195
|
it "has a right bar button item of the correct type" do
|
|
@@ -256,4 +261,3 @@ describe "screen with toolbar" do
|
|
|
256
261
|
screen.navigationController.toolbarHidden?.should == false
|
|
257
262
|
end
|
|
258
263
|
end
|
|
259
|
-
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
describe "Searchable table spec" do
|
|
2
|
+
# Override controller to properly instantiate
|
|
3
|
+
def controller
|
|
4
|
+
@controller ||= begin
|
|
5
|
+
c = TableScreenSearchable.new
|
|
6
|
+
c.on_load
|
|
7
|
+
c
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
after do
|
|
12
|
+
@controller = nil
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should show all 50 states" do
|
|
16
|
+
controller.tableView(controller.tableView, numberOfRowsInSection:0).should == 50
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should allow searching for all the 'New' states" do
|
|
20
|
+
controller.searchDisplayController(controller, shouldReloadTableForSearchString:"New")
|
|
21
|
+
controller.tableView(controller.tableView, numberOfRowsInSection:0).should == 4
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should allow ending searches" do
|
|
25
|
+
controller.searchDisplayController(controller, shouldReloadTableForSearchString:"North")
|
|
26
|
+
controller.tableView(controller.tableView, numberOfRowsInSection:0).should == 2
|
|
27
|
+
controller.searchDisplayControllerWillEndSearch(controller)
|
|
28
|
+
controller.tableView(controller.tableView, numberOfRowsInSection:0).should == 50
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "should expose the search_string variable and clear it properly" do
|
|
32
|
+
controller.searchDisplayController(controller, shouldReloadTableForSearchString:"North")
|
|
33
|
+
|
|
34
|
+
controller.search_string.should == "north"
|
|
35
|
+
controller.original_search_string.should == "North"
|
|
36
|
+
|
|
37
|
+
controller.searchDisplayControllerWillEndSearch(controller)
|
|
38
|
+
|
|
39
|
+
controller.search_string.should == false
|
|
40
|
+
controller.original_search_string.should == false
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "should call the start and stop searching callbacks properly" do
|
|
44
|
+
controller.will_begin_search_called.should == nil
|
|
45
|
+
controller.will_end_search_called.should == nil
|
|
46
|
+
|
|
47
|
+
controller.searchDisplayControllerWillBeginSearch(controller)
|
|
48
|
+
controller.searchDisplayController(controller, shouldReloadTableForSearchString:"North")
|
|
49
|
+
controller.will_begin_search_called.should == true
|
|
50
|
+
|
|
51
|
+
controller.searchDisplayControllerWillEndSearch(controller)
|
|
52
|
+
controller.will_end_search_called.should == true
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
@@ -6,7 +6,7 @@ describe "split screen in tab bar functionality" do
|
|
|
6
6
|
@master_screen = HomeScreen.new nav_bar: true
|
|
7
7
|
@detail_screen = BasicScreen.new nav_bar: true
|
|
8
8
|
|
|
9
|
-
@split_screen = @app.create_split_screen @master_screen, @detail_screen,
|
|
9
|
+
@split_screen = @app.create_split_screen @master_screen, @detail_screen, item: "list", title: "Spec"
|
|
10
10
|
@tab = @app.open_tab_bar @split_screen, HomeScreen, BasicScreen
|
|
11
11
|
end
|
|
12
12
|
|
|
@@ -49,15 +49,15 @@ describe "split screen in tab bar functionality" do
|
|
|
49
49
|
it "should set the tab bar first viewController to the split screen" do
|
|
50
50
|
@tab.viewControllers.first.should == @split_screen
|
|
51
51
|
end
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
it "should set the bar bar item for the split screen" do
|
|
54
54
|
@split_screen.tabBarItem.is_a?(UITabBarItem).should == true
|
|
55
55
|
end
|
|
56
|
-
|
|
57
|
-
it "should set the tab bar
|
|
56
|
+
|
|
57
|
+
it "should set the tab bar item of the split screen" do
|
|
58
58
|
@split_screen.tabBarItem.image.is_a?(UIImage).should == true
|
|
59
59
|
end
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
it "should set the tab bar title of the split screen" do
|
|
62
62
|
@split_screen.tabBarItem.title.is_a?(String).should == true
|
|
63
63
|
@split_screen.tabBarItem.title.should == "Spec"
|
|
@@ -37,9 +37,9 @@ describe "split screen functionality" do
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it "should set the title on both screens" do
|
|
40
|
-
@master_screen.class.
|
|
40
|
+
@master_screen.class.title.should == "Master"
|
|
41
41
|
@master_screen.title.should == "Master"
|
|
42
|
-
@detail_screen.class.
|
|
42
|
+
@detail_screen.class.title.should == "Detail"
|
|
43
43
|
@detail_screen.title.should == "Detail"
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -57,9 +57,9 @@ describe "split screen with UIViewControllers with ScreenModule" do
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
it "should set the title on both screens" do
|
|
60
|
-
@master_screen.class.
|
|
60
|
+
@master_screen.class.title.should == "Test Title"
|
|
61
61
|
@master_screen.title.should == "Test Title"
|
|
62
|
-
@detail_screen.class.
|
|
62
|
+
@detail_screen.class.title.should == "Detail"
|
|
63
63
|
@detail_screen.title.should == "Detail"
|
|
64
64
|
end
|
|
65
65
|
|