ProMotion 0.7.8 → 1.0.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 (91) hide show
  1. data/.gitignore +2 -1
  2. data/.travis.yml +1 -1
  3. data/ProMotion.gemspec +2 -0
  4. data/README.md +51 -449
  5. data/Rakefile +11 -1
  6. data/app/screens/basic_screen.rb +0 -24
  7. data/lib/ProMotion/cocoatouch/{NavigationController.rb → navigation_controller.rb} +0 -0
  8. data/lib/ProMotion/cocoatouch/split_view_controller.rb +29 -0
  9. data/lib/ProMotion/cocoatouch/tab_bar_controller.rb +43 -0
  10. data/lib/ProMotion/cocoatouch/{TableViewCell.rb → table_view_cell.rb} +0 -1
  11. data/lib/ProMotion/cocoatouch/{TableViewController.rb → table_view_controller.rb} +0 -0
  12. data/lib/ProMotion/cocoatouch/{ViewController.rb → view_controller.rb} +6 -1
  13. data/lib/ProMotion/{screen_helpers → containers}/split_screen.rb +0 -2
  14. data/lib/ProMotion/containers/tabs.rb +95 -0
  15. data/lib/ProMotion/delegate/delegate.rb +2 -13
  16. data/lib/ProMotion/delegate/{delegate_helper.rb → delegate_module.rb} +29 -16
  17. data/lib/ProMotion/delegate/delegate_notifications.rb +17 -8
  18. data/lib/ProMotion/delegate/delegate_parent.rb +11 -0
  19. data/lib/ProMotion/extensions/conversions.rb +20 -0
  20. data/lib/ProMotion/{helpers/logger.rb → logger.rb} +0 -0
  21. data/lib/ProMotion/map/map_screen.rb +6 -0
  22. data/lib/ProMotion/map/map_screen_annotation.rb +56 -0
  23. data/lib/ProMotion/map/map_screen_module.rb +207 -0
  24. data/lib/ProMotion/{push_notifications → push_notification}/push_notification.rb +13 -6
  25. data/lib/ProMotion/{screens → screen}/screen.rb +1 -1
  26. data/lib/ProMotion/{screens/_screen_module.rb → screen/screen_module.rb} +76 -51
  27. data/lib/ProMotion/{screen_helpers → screen}/screen_navigation.rb +8 -12
  28. data/lib/ProMotion/{screens/_tables → table/cell}/table_view_cell_module.rb +18 -27
  29. data/lib/ProMotion/table/data/table_data.rb +98 -0
  30. data/lib/ProMotion/table/extensions/indexable.rb +9 -0
  31. data/lib/ProMotion/table/extensions/refreshable.rb +45 -0
  32. data/lib/ProMotion/table/extensions/searchable.rb +61 -0
  33. data/lib/ProMotion/table/grouped_table.rb +9 -0
  34. data/lib/ProMotion/table/grouped_table_screen.rb +6 -0
  35. data/lib/ProMotion/table/table.rb +312 -0
  36. data/lib/ProMotion/table/table_screen.rb +6 -0
  37. data/lib/ProMotion/{screens/_compatibility → thirdparty}/formotion_screen.rb +18 -5
  38. data/lib/ProMotion/version.rb +1 -1
  39. data/lib/ProMotion/view/styling.rb +137 -0
  40. data/lib/ProMotion/web/web_screen.rb +6 -0
  41. data/lib/ProMotion/web/web_screen_module.rb +155 -0
  42. data/resources/WebScreen.html +6 -0
  43. data/resources/test.jpeg +0 -0
  44. data/spec/functional/func_map_screen_spec.rb +105 -0
  45. data/spec/functional/func_screen_spec.rb +54 -7
  46. data/spec/functional/func_searchable_table_spec.rb +1 -1
  47. data/spec/functional/func_tab_bar_spec.rb +78 -0
  48. data/spec/functional/func_table_screen_spec.rb +61 -14
  49. data/spec/functional/func_web_screen_spec.rb +51 -0
  50. data/spec/helpers/map_screen.rb +51 -0
  51. data/spec/helpers/present_screen.rb +26 -0
  52. data/spec/helpers/tab_screen.rb +4 -0
  53. data/spec/helpers/table_screen.rb +12 -3
  54. data/spec/helpers/table_screen_formotion.rb +25 -0
  55. data/spec/helpers/table_screen_indexable.rb +13 -0
  56. data/spec/helpers/test_delegate.rb +28 -0
  57. data/spec/helpers/web_screen.rb +22 -0
  58. data/spec/unit/delegate_spec.rb +53 -4
  59. data/spec/unit/map_spec.rb +48 -0
  60. data/spec/unit/screen_helpers_spec.rb +24 -16
  61. data/spec/unit/screen_spec.rb +22 -18
  62. data/spec/unit/split_screen_in_tab_bar_spec.rb +2 -2
  63. data/spec/unit/split_screen_open_screen_spec.rb +15 -10
  64. data/spec/unit/split_screen_spec.rb +2 -2
  65. data/spec/unit/tab_spec.rb +41 -0
  66. data/spec/unit/tables/formotion_screen_spec.rb +16 -0
  67. data/spec/unit/tables/table_indexable_spec.rb +12 -0
  68. data/spec/unit/tables/table_module_spec.rb +24 -9
  69. data/spec/unit/tables/table_screen_spec.rb +1 -1
  70. data/spec/unit/tables/table_view_cell_spec.rb +9 -8
  71. data/spec/unit/view_helper_spec.rb +2 -2
  72. data/spec/unit/web_spec.rb +106 -0
  73. metadata +96 -35
  74. data/lib/ProMotion/cocoatouch/SplitViewController.rb +0 -23
  75. data/lib/ProMotion/helpers/console.rb +0 -29
  76. data/lib/ProMotion/helpers/measure_helper.rb +0 -20
  77. data/lib/ProMotion/helpers/system_helper.rb +0 -29
  78. data/lib/ProMotion/helpers/view_helper.rb +0 -82
  79. data/lib/ProMotion/screen_helpers/screen_elements.rb +0 -36
  80. data/lib/ProMotion/screen_helpers/screen_tabs.rb +0 -95
  81. data/lib/ProMotion/screens/_table_screen_module.rb +0 -47
  82. data/lib/ProMotion/screens/_tables/_refreshable_table.rb +0 -45
  83. data/lib/ProMotion/screens/_tables/_searchable_table.rb +0 -60
  84. data/lib/ProMotion/screens/_tables/_sectioned_table.rb +0 -5
  85. data/lib/ProMotion/screens/_tables/_table.rb +0 -169
  86. data/lib/ProMotion/screens/_tables/grouped_table.rb +0 -16
  87. data/lib/ProMotion/screens/_tables/plain_table.rb +0 -17
  88. data/lib/ProMotion/screens/_tables/table_data.rb +0 -175
  89. data/lib/ProMotion/screens/behaves_like_screen.rb +0 -10
  90. data/lib/ProMotion/screens/table_screen.rb +0 -16
  91. data/spec/unit/ios_version_spec.rb +0 -28
@@ -0,0 +1,25 @@
1
+ class TestFormotionScreen < PM::FormotionScreen
2
+
3
+ title "Formotion Test"
4
+
5
+ def table_data
6
+ @data ||= {
7
+ sections: [{
8
+ title: "Currency",
9
+ key: :currency,
10
+ select_one: true,
11
+ rows: [{
12
+ title: "EUR",
13
+ key: :eur,
14
+ value: true,
15
+ type: :check
16
+ }, {
17
+ title: "USD",
18
+ key: :usd,
19
+ type: :check
20
+ }]
21
+ }]
22
+ }
23
+ end
24
+
25
+ end
@@ -0,0 +1,13 @@
1
+ class TableScreenIndexable < PM::TableScreen
2
+ indexable
3
+
4
+ def table_data
5
+ %w{ Apple Google Microsoft Oracle Sun UNIX }.map do |group_name|
6
+ {
7
+ title: "#{group_name} Group",
8
+ cells: [{ title: "Single cell for group #{group_name}" }]
9
+ }
10
+ end
11
+ end
12
+
13
+ end
@@ -1,6 +1,34 @@
1
1
  class TestDelegate < ProMotion::Delegate
2
2
  status_bar false
3
3
 
4
+ attr_accessor :called_on_load, :called_will_load, :called_on_activate, :called_will_deactivate, :called_on_enter_background, :called_will_enter_foreground, :called_on_unload
5
+
4
6
  def on_load(app, options)
7
+ self.called_on_load = true
8
+ end
9
+
10
+ def will_load(application, launch_options)
11
+ self.called_will_load = true
12
+ end
13
+
14
+ def on_activate
15
+ self.called_on_activate = true
16
+ end
17
+
18
+ def will_deactivate
19
+ self.called_will_deactivate = true
5
20
  end
21
+
22
+ def on_enter_background
23
+ self.called_on_enter_background = true
24
+ end
25
+
26
+ def will_enter_foreground
27
+ self.called_will_enter_foreground = true
28
+ end
29
+
30
+ def on_unload
31
+ self.called_on_unload = true
32
+ end
33
+
6
34
  end
@@ -0,0 +1,22 @@
1
+ class TestWebScreen < PM::WebScreen
2
+
3
+ title "WebScreen Test"
4
+
5
+ attr_accessor :load_started, :load_failed, :load_finished, :load_failed_error
6
+
7
+ def load_started
8
+ self.load_started = true
9
+ end
10
+
11
+ def load_finished
12
+ self.load_finished = true
13
+ end
14
+
15
+ def load_failed(error)
16
+ puts "Load Failed: #{error.localizedDescription}"
17
+ puts error.localizedFailureReason
18
+ self.load_failed = true
19
+ self.load_failed_error = error
20
+ end
21
+
22
+ end
@@ -13,7 +13,7 @@ describe "PM::Delegate" do
13
13
 
14
14
  it "should handle push notifications" do
15
15
 
16
- @subject.mock!(:on_push_notification) do |notification|
16
+ @subject.mock!(:on_push_notification) do |notification, was_launched|
17
17
  notification.should.be.kind_of(PM::PushNotification)
18
18
  notification.alert.should == "Eating Bacon"
19
19
  notification.badge.should == 42
@@ -22,17 +22,66 @@ describe "PM::Delegate" do
22
22
  end
23
23
 
24
24
  launch_options = { UIApplicationLaunchOptionsRemoteNotificationKey => PM::PushNotification.fake_notification(alert: "Eating Bacon", badge: 42, sound: "jamon").notification }
25
- @subject.application(nil, didFinishLaunchingWithOptions:launch_options )
25
+ @subject.application(UIApplication.sharedApplication, willFinishLaunchingWithOptions: nil)
26
+ @subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions:launch_options )
26
27
 
27
28
  end
28
29
 
29
30
  it "should set home_screen when opening a new screen" do
30
-
31
+ @subject.application(UIApplication.sharedApplication, willFinishLaunchingWithOptions: nil)
31
32
  @subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions: nil)
32
- @subject.open BasicScreen.new(nav_bar: true)
33
+ screen = @subject.open BasicScreen.new(nav_bar: true)
33
34
  @subject.home_screen.should.be.kind_of BasicScreen
34
35
  @subject.window.rootViewController.should.be.kind_of UINavigationController
36
+ screen.should.be.kind_of BasicScreen
37
+ end
35
38
 
39
+ it "should call will_load on launch" do
40
+ @subject.called_will_load.should == nil
41
+ @subject.application(UIApplication.sharedApplication, willFinishLaunchingWithOptions: nil)
42
+ @subject.called_will_load.should == true
43
+ end
44
+
45
+ it "should call will_deactivate when quitting" do
46
+ @subject.application(UIApplication.sharedApplication, willFinishLaunchingWithOptions: nil)
47
+ @subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions: nil)
48
+ @subject.called_will_deactivate.should == nil
49
+ @subject.applicationWillResignActive(UIApplication.sharedApplication)
50
+ @subject.called_will_deactivate.should == true
51
+ end
52
+
53
+ it "should call on_activate when resuming from an inactive state" do
54
+ @subject.application(UIApplication.sharedApplication, willFinishLaunchingWithOptions: nil)
55
+ @subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions: nil)
56
+ @subject.applicationWillResignActive(UIApplication.sharedApplication)
57
+ @subject.called_on_activate.should == nil
58
+ @subject.applicationDidBecomeActive(UIApplication.sharedApplication)
59
+ @subject.called_on_activate.should == true
60
+ end
61
+
62
+ it "should call on_enter_background when hitting the home button" do
63
+ @subject.application(UIApplication.sharedApplication, willFinishLaunchingWithOptions: nil)
64
+ @subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions: nil)
65
+ @subject.called_on_enter_background.should == nil
66
+ @subject.applicationDidEnterBackground(UIApplication.sharedApplication)
67
+ @subject.called_on_enter_background.should == true
68
+ end
69
+
70
+ it "should call will_enter_foreground when hitting the home button" do
71
+ @subject.application(UIApplication.sharedApplication, willFinishLaunchingWithOptions: nil)
72
+ @subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions: nil)
73
+ @subject.applicationDidEnterBackground(UIApplication.sharedApplication)
74
+ @subject.called_will_enter_foreground.should == nil
75
+ @subject.applicationWillEnterForeground(UIApplication.sharedApplication)
76
+ @subject.called_will_enter_foreground.should == true
77
+ end
78
+
79
+ it "should call on_unload when the device is about to kill the app" do
80
+ @subject.application(UIApplication.sharedApplication, willFinishLaunchingWithOptions: nil)
81
+ @subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions: nil)
82
+ @subject.called_on_unload.should == nil
83
+ @subject.applicationWillTerminate(UIApplication.sharedApplication)
84
+ @subject.called_on_unload.should == true
36
85
  end
37
86
 
38
87
  end
@@ -0,0 +1,48 @@
1
+ describe "map properties" do
2
+
3
+ before do
4
+ # Simulate AppDelegate setup of map screen
5
+ @map = TestMapScreen.new modal: true, nav_bar: true
6
+ @map.view_will_appear(false)
7
+ end
8
+
9
+ it "should store title" do
10
+ @map.get_title.should == "Gorges State Park, NC"
11
+ end
12
+
13
+ it "should have 5 annotations" do
14
+ @map.annotations.count.should == 5
15
+ end
16
+
17
+ it "should convert annotation hashes to MapViewAnnotations" do
18
+ @map.annotations.each do |annotation|
19
+ annotation.class.to_s.should == "NSKVONotifying_MapScreenAnnotation"
20
+ end
21
+ end
22
+
23
+ it "should add an annotation" do
24
+ ann = {
25
+ longitude: -82.966093558105,
26
+ latitude: 35.092520895652,
27
+ title: "Something Else"
28
+ }
29
+ @map.add_annotation(ann)
30
+ @map.annotations.count.should == 6
31
+ end
32
+
33
+ it "should clear annotations" do
34
+ @map.clear_annotations
35
+ @map.annotations.count.should == 0
36
+ end
37
+
38
+ it "should geocode an address" do
39
+ @map.lookup_infinite_loop
40
+ wait_for_change @map, 'infinite_loop_points' do
41
+ placemarks = @map.infinite_loop_points
42
+ placemarks.count.should == 1
43
+ placemarks.first.postalCode.should == "95014"
44
+ placemarks.first.description.include?("Cupertino").should == true
45
+ end
46
+ end
47
+
48
+ end
@@ -45,36 +45,36 @@ describe "screen helpers" do
45
45
  end
46
46
 
47
47
  it "should add a left nav bar button" do
48
- @screen.set_nav_bar_left_button "Save", action: :save_something, type: UIBarButtonItemStyleDone
48
+ @screen.set_nav_bar_button :left, title: "Save", action: :save_something, type: UIBarButtonItemStyleDone
49
49
  @screen.navigationItem.leftBarButtonItem.class.should == UIBarButtonItem
50
50
  end
51
51
 
52
52
  it "should add a right nav bar button" do
53
- @screen.set_nav_bar_right_button "Cancel", action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
53
+ @screen.set_nav_bar_button :right, title: "Cancel", action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
54
54
  @screen.navigationItem.rightBarButtonItem.class.should == UIBarButtonItem
55
55
  end
56
56
 
57
57
  it "should add an image right nav bar button" do
58
58
  image = UIImage.imageNamed("list.png")
59
- @screen.set_nav_bar_right_button image, action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
59
+ @screen.set_nav_bar_button :right, image: image, action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
60
60
  @screen.navigationItem.rightBarButtonItem.image.class.should == UIImage
61
61
  @screen.navigationItem.rightBarButtonItem.image.should == image
62
62
  end
63
63
 
64
64
  it "should add an image left nav bar button" do
65
65
  image = UIImage.imageNamed("list.png")
66
- @screen.set_nav_bar_left_button image, action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
66
+ @screen.set_nav_bar_button :left, image: image, action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
67
67
  @screen.navigationItem.leftBarButtonItem.image.class.should == UIImage
68
68
  @screen.navigationItem.leftBarButtonItem.image.should == image
69
69
  end
70
70
 
71
71
  it "should add a left UIBarButtonItem" do
72
- @screen.set_nav_bar_left_button @screen.editButtonItem
72
+ @screen.set_nav_bar_button :left, system_item: :edit
73
73
  @screen.navigationItem.leftBarButtonItem.class.should == UIBarButtonItem
74
74
  end
75
75
 
76
76
  it "should add a right UIBarButtonItem" do
77
- @screen.set_nav_bar_right_button @screen.editButtonItem
77
+ @screen.set_nav_bar_button :right, system_item: :add
78
78
  @screen.navigationItem.rightBarButtonItem.class.should == UIBarButtonItem
79
79
  end
80
80
  end
@@ -121,11 +121,11 @@ describe "screen helpers" do
121
121
  new_screen.nav_bar?.should == true
122
122
  end
123
123
 
124
- it "should present the #main_controller when showing a modal screen" do
124
+ it "should present the navigationController when showing a modal screen" do
125
125
  new_screen = @screen.send(:set_up_screen_for_open, BasicScreen, modal: true)
126
126
 
127
127
  @screen.mock!('presentModalViewController:animated:') do |vc, animated|
128
- vc.should == new_screen.main_controller
128
+ vc.should == (new_screen.navigationController || new_screen)
129
129
  animated.should == true
130
130
  end
131
131
  @screen.send(:present_modal_view_controller, new_screen, true)
@@ -141,7 +141,8 @@ describe "screen helpers" do
141
141
 
142
142
  it "should open a root screen if :close_all is provided" do
143
143
  @screen.mock!(:open_root_screen) { |screen| screen.should.be.instance_of BasicScreen }
144
- @screen.open BasicScreen, close_all: true
144
+ screen = @screen.open BasicScreen, close_all: true
145
+ screen.should.be.kind_of BasicScreen
145
146
  end
146
147
 
147
148
  it "should present a modal screen if :modal is provided" do
@@ -149,7 +150,8 @@ describe "screen helpers" do
149
150
  screen.should.be.instance_of BasicScreen
150
151
  animated.should == true
151
152
  end
152
- @screen.open BasicScreen, modal: true
153
+ screen = @screen.open BasicScreen, modal: true
154
+ screen.should.be.kind_of BasicScreen
153
155
  end
154
156
 
155
157
  it "should present a modal screen if open_modal is used" do
@@ -157,7 +159,8 @@ describe "screen helpers" do
157
159
  screen.should.be.instance_of BasicScreen
158
160
  animated.should == true
159
161
  end
160
- @screen.open_modal BasicScreen
162
+ screen = @screen.open_modal BasicScreen
163
+ screen.should.be.kind_of BasicScreen
161
164
  end
162
165
 
163
166
  it "should respect animated property of opening modal screens" do
@@ -167,7 +170,8 @@ describe "screen helpers" do
167
170
  animated.should == false
168
171
  end
169
172
 
170
- @screen.send(:open, new_screen, animated: false, modal: true)
173
+ screen = @screen.send(:open, new_screen, animated: false, modal: true)
174
+ screen.should.be.kind_of BasicScreen
171
175
  end
172
176
 
173
177
  it "should open screen in tab bar if :in_tab is provided" do
@@ -176,17 +180,20 @@ describe "screen helpers" do
176
180
  screen.should.be.instance_of BasicScreen
177
181
  tab_name.should == 'my_tab'
178
182
  end
179
- @screen.open BasicScreen, in_tab: 'my_tab'
183
+ screen = @screen.open BasicScreen, in_tab: 'my_tab'
184
+ screen.should.be.kind_of BasicScreen
180
185
  end
181
186
 
182
187
  it "should pop onto navigation controller if current screen is on nav stack already" do
183
188
  @screen.mock!(:push_view_controller) { |vc| vc.should.be.instance_of BasicScreen }
184
- @screen.open BasicScreen
189
+ screen = @screen.open BasicScreen
190
+ screen.should.be.kind_of BasicScreen
185
191
  end
186
192
 
187
193
  it "should ignore its own navigation controller if current screen has a navigation controller" do
188
194
  basic = BasicScreen.new(nav_bar: true) # creates a dangling nav_bar that will be discarded.
189
- @screen.open basic
195
+ screen = @screen.open basic
196
+ screen.should.be.kind_of BasicScreen
190
197
  basic.navigationController.should == @screen.navigationController
191
198
  basic.navigation_controller.should == @screen.navigationController
192
199
  @screen.navigation_controller.should == @screen.navigationController
@@ -196,7 +203,8 @@ describe "screen helpers" do
196
203
  parent_screen = HomeScreen.new
197
204
  new_screen = BasicScreen.new
198
205
  parent_screen.mock!(:open_root_screen) { |vc| vc.should.be == new_screen }
199
- parent_screen.open_screen new_screen
206
+ screen = parent_screen.open_screen new_screen
207
+ screen.should == new_screen
200
208
  end
201
209
 
202
210
  end
@@ -25,6 +25,25 @@ describe "screen properties" do
25
25
  @screen.title = "instance method"
26
26
  HomeScreen.get_title.should != 'instance method'
27
27
  end
28
+
29
+ it "should set the tab bar item with a system icon" do
30
+ @screen.set_tab_bar_item system_icon: :contacts
31
+ comparison = UITabBarItem.alloc.initWithTabBarSystemItem(UITabBarSystemItemContacts, tag: 0)
32
+ @screen.tabBarItem.systemItem.should == comparison.systemItem
33
+ @screen.tabBarItem.tag.should == comparison.tag
34
+ @screen.tabBarItem.image.should == comparison.image
35
+ end
36
+
37
+ it "should set the tab bar item with a custom icon and title" do
38
+ @screen.set_tab_bar_item title: "My Screen", icon: "list"
39
+
40
+ icon_image = UIImage.imageNamed("list")
41
+ comparison = UITabBarItem.alloc.initWithTitle("My Screen", image: icon_image, tag: 0)
42
+
43
+ @screen.tabBarItem.systemItem.should == comparison.systemItem
44
+ @screen.tabBarItem.tag.should == comparison.tag
45
+ @screen.tabBarItem.image.should == comparison.image
46
+ end
28
47
 
29
48
  it "should store debug mode" do
30
49
  HomeScreen.debug_mode = true
@@ -109,30 +128,15 @@ describe "screen properties" do
109
128
 
110
129
  end
111
130
 
112
-
113
- describe "pm_main_controller" do
114
-
115
- it "should return the navigation controller wrapper" do
116
- @screen.pm_main_controller.should.be.instance_of ProMotion::NavigationController
117
- end
118
-
119
- it "should return itself when screen is a plain UIViewController" do
120
- vc = UIViewController.alloc.initWithNibName(nil, bundle: nil)
121
- vc.respond_to?(:pm_main_controller).should == true
122
- vc.pm_main_controller.should == vc
123
- end
124
-
125
- end
126
-
127
-
128
131
  describe "navigation controller behavior" do
129
132
 
130
133
  it "should have a nav bar" do
131
134
  @screen.nav_bar?.should == true
132
135
  end
133
136
 
134
- it "#main_controller should return a navigation controller" do
135
- @screen.main_controller.should.be.instance_of ProMotion::NavigationController
137
+ it "#navigation_controller should return a navigation controller" do
138
+ @screen.navigation_controller.should.be.instance_of ProMotion::NavigationController
139
+ @screen.navigationController.should.be.instance_of ProMotion::NavigationController
136
140
  end
137
141
 
138
142
  it "have a right bar button item" do
@@ -38,12 +38,12 @@ describe "split screen in tab bar functionality" do
38
38
 
39
39
  it "should set the first viewController to HomeScreen's main controller" do
40
40
  @split_screen.master_screen.should == @master_screen
41
- @split_screen.viewControllers.first.should == @master_screen.pm_main_controller
41
+ @split_screen.viewControllers.first.should == (@master_screen.navigationController || @master_screen)
42
42
  end
43
43
 
44
44
  it "should set the second viewController to BasicScreen's main controller" do
45
45
  @split_screen.detail_screen.should == @detail_screen
46
- @split_screen.viewControllers.last.should == @detail_screen.pm_main_controller
46
+ @split_screen.viewControllers.last.should == (@detail_screen.navigationController || @detail_screen)
47
47
  end
48
48
 
49
49
  it "should set the tab bar first viewController to the split screen" do
@@ -15,36 +15,41 @@ describe "split screen `open` functionality" do
15
15
  end
16
16
 
17
17
  it "should open a new screen in the detail view" do
18
- @master_screen.open @detail_screen_2, in_detail: true
18
+ screen = @master_screen.open @detail_screen_2, in_detail: true
19
19
  @split_screen.detail_screen.should == @detail_screen_2
20
- @split_screen.viewControllers.first.should == @master_screen.pm_main_controller
21
- @split_screen.viewControllers.last.should == @detail_screen_2.pm_main_controller
20
+ @split_screen.viewControllers.first.should == (@master_screen.navigationController || @master_screen)
21
+ @split_screen.viewControllers.last.should == (@detail_screen_2.navigationController || @detail_screen_2)
22
+ screen.should == @detail_screen_2
22
23
  end
23
24
 
24
25
  it "should open a new screen in the master view" do
25
- @detail_screen_1.open @detail_screen_2, in_master: true
26
+ screen = @detail_screen_1.open @detail_screen_2, in_master: true
26
27
  @split_screen.master_screen.should == @detail_screen_2
27
- @split_screen.viewControllers.first.should == @detail_screen_2.pm_main_controller
28
- @split_screen.viewControllers.last.should == @detail_screen_1.pm_main_controller
28
+ @split_screen.viewControllers.first.should == (@detail_screen_2.navigationController || @detail_screen_2)
29
+ @split_screen.viewControllers.last.should == (@detail_screen_1.navigationController || @detail_screen_1)
30
+ screen.should == @detail_screen_2
29
31
  end
30
32
 
31
33
  it "should open a new screen in the master view's navigation controller" do
32
- @master_screen.open @detail_screen_2
34
+ screen = @master_screen.open @detail_screen_2
33
35
  @split_screen.detail_screen.should == @detail_screen_1 # no change
34
36
  @master_screen.navigationController.topViewController.should == @detail_screen_2
37
+ screen.should == @detail_screen_2
35
38
  end
36
39
 
37
40
  it "should open a new modal screen in the detail view" do
38
- @detail_screen_1.open @detail_screen_2, modal: true
41
+ screen = @detail_screen_1.open @detail_screen_2, modal: true
39
42
  @split_screen.detail_screen.should == @detail_screen_1
40
- @detail_screen_1.presentedViewController.should == @detail_screen_2.pm_main_controller
43
+ @detail_screen_1.presentedViewController.should == (@detail_screen_2.navigationController || @detail_screen_2)
44
+ screen.should == @detail_screen_2
41
45
  end
42
46
 
43
47
  it "should not interfere with normal non-split screen navigation" do
44
48
  home = HomeScreen.new(nav_bar: true)
45
49
  child = BasicScreen.new
46
- home.open child, in_detail: true, in_master: true
50
+ screen = home.open child, in_detail: true, in_master: true
47
51
  home.navigation_controller.topViewController.should == child
52
+ screen.should == child
48
53
  end
49
54
 
50
55
  end