ProMotion 1.2.1 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +36 -10
  3. data/lib/ProMotion.rb +11 -2
  4. data/lib/ProMotion/cocoatouch/ns_string.rb +5 -0
  5. data/lib/ProMotion/cocoatouch/ns_url.rb +5 -0
  6. data/lib/ProMotion/cocoatouch/tab_bar_controller.rb +5 -7
  7. data/lib/ProMotion/cocoatouch/table_view_cell.rb +0 -16
  8. data/lib/ProMotion/cocoatouch/table_view_controller.rb +2 -3
  9. data/lib/ProMotion/cocoatouch/view_controller.rb +3 -6
  10. data/lib/ProMotion/delegate/delegate.rb +0 -3
  11. data/lib/ProMotion/delegate/delegate_module.rb +24 -20
  12. data/lib/ProMotion/{containers → ipad}/split_screen.rb +30 -32
  13. data/lib/ProMotion/{logger.rb → logger/logger.rb} +6 -5
  14. data/lib/ProMotion/screen/nav_bar_module.rb +126 -0
  15. data/lib/ProMotion/screen/screen.rb +0 -3
  16. data/lib/ProMotion/screen/screen_module.rb +54 -177
  17. data/lib/ProMotion/screen/screen_navigation.rb +29 -40
  18. data/lib/ProMotion/{view → styling}/styling.rb +17 -47
  19. data/lib/ProMotion/table/cell/table_view_cell_module.rb +76 -123
  20. data/lib/ProMotion/table/data/table_data.rb +1 -1
  21. data/lib/ProMotion/table/extensions/longpressable.rb +24 -0
  22. data/lib/ProMotion/table/extensions/refreshable.rb +1 -0
  23. data/lib/ProMotion/table/grouped_table_screen.rb +0 -5
  24. data/lib/ProMotion/table/table.rb +63 -83
  25. data/lib/ProMotion/table/table_screen.rb +0 -4
  26. data/lib/ProMotion/{containers → tabs}/tabs.rb +20 -21
  27. data/lib/ProMotion/version.rb +1 -1
  28. data/lib/ProMotion/web/web_screen.rb +0 -4
  29. data/lib/ProMotion/web/web_screen_module.rb +8 -5
  30. data/spec/functional/func_screen_spec.rb +14 -18
  31. data/spec/functional/func_split_screen_spec.rb +2 -2
  32. data/spec/functional/func_table_screen_spec.rb +54 -40
  33. data/spec/functional/func_web_screen_spec.rb +12 -17
  34. data/spec/helpers/test_helper.rb +27 -0
  35. data/spec/unit/delegate_spec.rb +4 -67
  36. data/spec/unit/image_title_screen.rb +9 -0
  37. data/spec/unit/image_view_title_screen.rb +9 -0
  38. data/spec/unit/load_view_spec.rb +27 -0
  39. data/spec/unit/main_spec.rb +0 -6
  40. data/spec/unit/screen_helpers_spec.rb +23 -17
  41. data/spec/unit/screen_spec.rb +21 -17
  42. data/spec/unit/searchable_table_spec.rb +55 -0
  43. data/spec/unit/split_screen_in_tab_bar_spec.rb +5 -5
  44. data/spec/unit/split_screen_spec.rb +4 -4
  45. data/spec/unit/tab_bar_spec.rb +79 -0
  46. data/spec/unit/tab_spec.rb +11 -5
  47. data/spec/unit/tables/table_module_spec.rb +22 -8
  48. data/spec/unit/tables/table_screen_spec.rb +1 -1
  49. data/spec/unit/tables/table_view_cell_spec.rb +16 -16
  50. data/spec/unit/view_helper_spec.rb +6 -81
  51. data/spec/unit/view_title_screen.rb +10 -0
  52. data/spec/unit/web_spec.rb +31 -37
  53. metadata +37 -111
  54. data/.gitignore +0 -33
  55. data/.travis.yml +0 -4
  56. data/CONTRIBUTING.md +0 -20
  57. data/Gemfile +0 -5
  58. data/LICENSE +0 -22
  59. data/ProMotion.gemspec +0 -30
  60. data/Rakefile +0 -66
  61. data/app/app_delegate.rb +0 -7
  62. data/app/screens/basic_screen.rb +0 -15
  63. data/lib/ProMotion/delegate/delegate_notifications.rb +0 -70
  64. data/lib/ProMotion/extensions/conversions.rb +0 -20
  65. data/lib/ProMotion/map/map_screen.rb +0 -10
  66. data/lib/ProMotion/map/map_screen_annotation.rb +0 -65
  67. data/lib/ProMotion/map/map_screen_module.rb +0 -212
  68. data/lib/ProMotion/push_notification/push_notification.rb +0 -58
  69. data/resources/WebScreen.html +0 -6
  70. data/resources/list.png +0 -0
  71. data/resources/test.png +0 -0
  72. data/spec/functional/func_image_title_screen.rb +0 -20
  73. data/spec/functional/func_image_view_title_screen.rb +0 -20
  74. data/spec/functional/func_map_screen_spec.rb +0 -162
  75. data/spec/functional/func_searchable_table_spec.rb +0 -56
  76. data/spec/functional/func_tab_bar_spec.rb +0 -78
  77. data/spec/functional/func_view_title_screen.rb +0 -21
  78. data/spec/helpers/basic_screen.rb +0 -3
  79. data/spec/helpers/custom_title_view.rb +0 -4
  80. data/spec/helpers/detail_screen.rb +0 -3
  81. data/spec/helpers/dummy_class.rb +0 -3
  82. data/spec/helpers/functional_screen.rb +0 -15
  83. data/spec/helpers/home_screen.rb +0 -19
  84. data/spec/helpers/image_title_screen.rb +0 -15
  85. data/spec/helpers/image_view_title_screen.rb +0 -15
  86. data/spec/helpers/map_screen.rb +0 -53
  87. data/spec/helpers/master_screen.rb +0 -3
  88. data/spec/helpers/present_screen.rb +0 -26
  89. data/spec/helpers/screen_module_view_controller.rb +0 -55
  90. data/spec/helpers/tab_screen.rb +0 -4
  91. data/spec/helpers/table_screen.rb +0 -117
  92. data/spec/helpers/table_screen_indexable.rb +0 -18
  93. data/spec/helpers/table_screen_refreshable.rb +0 -11
  94. data/spec/helpers/table_screen_searchable.rb +0 -72
  95. data/spec/helpers/test_delegate.rb +0 -34
  96. data/spec/helpers/test_delegate_colors.rb +0 -17
  97. data/spec/helpers/view_title_screen.rb +0 -15
  98. data/spec/helpers/web_screen.rb +0 -23
  99. data/spec/unit/map_spec.rb +0 -71
@@ -1,7 +1,3 @@
1
- motion_require '../cocoatouch/table_view_controller'
2
- motion_require '../screen/screen_module'
3
- motion_require 'table'
4
-
5
1
  module ProMotion
6
2
  class TableScreen < TableViewController
7
3
  include ProMotion::ScreenModule
@@ -1,9 +1,5 @@
1
- motion_require '../extensions/conversions'
2
-
3
1
  module ProMotion
4
2
  module Tabs
5
- include Conversions
6
-
7
3
  attr_accessor :tab_bar, :tab_bar_item
8
4
 
9
5
  def open_tab_bar(*screens)
@@ -25,7 +21,7 @@ module ProMotion
25
21
  end
26
22
 
27
23
  def refresh_tab_bar_item
28
- self.tabBarItem = create_tab_bar_item(self.tab_bar_item) if self.tab_bar_item && self.respond_to?(:tabBarItem=)
24
+ self.tabBarItem = create_tab_bar_item(self.tab_bar_item) if self.tab_bar_item && self.respond_to?("tabBarItem=")
29
25
  end
30
26
 
31
27
  def set_tab_bar_badge(number)
@@ -33,36 +29,39 @@ module ProMotion
33
29
  refresh_tab_bar_item
34
30
  end
35
31
 
36
- def create_tab_bar_icon(icon, tag)
37
- return UITabBarItem.alloc.initWithTabBarSystemItem(icon, tag: tag)
38
- end
39
-
40
- def create_tab_bar_icon_custom(title, icon_image, tag)
41
- if icon_image.is_a?(String)
42
- icon_image = UIImage.imageNamed(icon_image)
43
- elsif icon_image.is_a?(Hash)
44
- icon_selected = icon_image[:selected]
45
- icon_unselected = icon_image[:unselected]
46
- icon_image = nil
32
+ def create_tab_bar_item_custom(title, item_image, tag)
33
+ if item_image.is_a?(String)
34
+ item_image = UIImage.imageNamed(item_image)
35
+ elsif item_image.is_a?(Hash)
36
+ item_selected = item_image[:selected]
37
+ item_unselected = item_image[:unselected]
38
+ item_image = nil
47
39
  end
48
40
 
49
- item = UITabBarItem.alloc.initWithTitle(title, image:icon_image, tag:tag)
41
+ item = UITabBarItem.alloc.initWithTitle(title, image:item_image, tag:tag)
50
42
 
51
- if icon_selected || icon_unselected
52
- item.setFinishedSelectedImage(icon_selected, withFinishedUnselectedImage: icon_unselected)
43
+ if item_selected || item_unselected
44
+ item.setFinishedSelectedImage(item_selected, withFinishedUnselectedImage: item_unselected)
53
45
  end
54
46
 
55
47
  return item
56
48
  end
57
49
 
58
50
  def create_tab_bar_item(tab={})
51
+ if tab[:system_icon] || tab[:icon]
52
+ PM.logger.deprecated("`system_icon:` no longer supported. Use `system_item:` instead.") if tab[:system_icon]
53
+ PM.logger.deprecated("`icon:` no longer supported. Use `item:` instead.") if tab[:icon]
54
+ tab[:system_item] ||= tab[:system_icon]
55
+ tab[:item] ||= tab[:icon]
56
+ end
57
+
59
58
  title = "Untitled"
60
59
  title = tab[:title] if tab[:title]
61
60
  tab[:tag] ||= @current_tag ||= 0
62
61
  @current_tag = tab[:tag] + 1
63
62
 
64
- tab_bar_item = create_tab_bar_icon(map_tab_symbol(tab[:system_icon]), tab[:tag]) if tab[:system_icon]
65
- tab_bar_item = create_tab_bar_icon_custom(title, tab[:icon], tab[:tag]) if tab[:icon]
63
+ tab_bar_item = UITabBarItem.alloc.initWithTabBarSystemItem(map_tab_symbol(tab[:system_item]), tag: tab[:tag]) if tab[:system_item]
64
+ tab_bar_item = create_tab_bar_item_custom(title, tab[:item], tab[:tag]) if tab[:item]
66
65
 
67
66
  tab_bar_item.badgeValue = tab[:badge_number].to_s unless tab[:badge_number].nil? || tab[:badge_number] <= 0
68
67
 
@@ -1,3 +1,3 @@
1
1
  module ProMotion
2
- VERSION = "1.2.1" unless defined?(ProMotion::VERSION)
2
+ VERSION = "2.0.0.rc1" unless defined?(ProMotion::VERSION)
3
3
  end
@@ -1,7 +1,3 @@
1
- motion_require '../cocoatouch/view_controller'
2
- motion_require '../screen/screen_module'
3
- motion_require 'web_screen_module'
4
-
5
1
  module ProMotion
6
2
  class WebScreen < ViewController
7
3
  include ProMotion::ScreenModule
@@ -1,20 +1,22 @@
1
1
  module ProMotion
2
2
  module WebScreenModule
3
3
 
4
- attr_accessor :webview, :external_links, :detector_types
4
+ attr_accessor :webview, :external_links, :detector_types, :scale_to_fit
5
5
 
6
6
  def screen_setup
7
7
  check_content_data
8
8
  self.external_links ||= false
9
+ self.scale_to_fit ||= false
10
+ self.detector_types ||= :none
9
11
  end
10
12
 
11
13
  def on_init
12
-
13
- self.detector_types ||= UIDataDetectorTypeNone
14
14
  if self.detector_types.is_a? Array
15
15
  detectors = UIDataDetectorTypeNone
16
16
  self.detector_types.each { |dt| detectors |= map_detector_symbol(dt) }
17
17
  self.detector_types = detectors
18
+ else
19
+ self.detector_types = map_detector_symbol(self.detector_types)
18
20
  end
19
21
 
20
22
  self.webview ||= add UIWebView.new, {
@@ -23,6 +25,7 @@ module ProMotion
23
25
  delegate: self,
24
26
  data_detector_types: self.detector_types
25
27
  }
28
+ self.webview.scalesPageToFit = self.scale_to_fit
26
29
  self.webview.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal
27
30
  set_initial_content
28
31
  end
@@ -108,11 +111,11 @@ module ProMotion
108
111
  end
109
112
 
110
113
  def open_in_safari(inRequest)
111
- #Open UIWebView delegate links in Safari.
114
+ # Open UIWebView delegate links in Safari.
112
115
  UIApplication.sharedApplication.openURL(inRequest.URL)
113
116
  end
114
117
 
115
- #UIWebViewDelegate Methods - Camelcase
118
+ # UIWebViewDelegate Methods - Camelcase
116
119
  def webView(inWeb, shouldStartLoadWithRequest:inRequest, navigationType:inType)
117
120
  if self.external_links == true && inType == UIWebViewNavigationTypeLinkClicked
118
121
  if defined?(OpenInChromeController)
@@ -4,18 +4,14 @@ describe "ProMotion::Screen functional" do
4
4
  # Override controller to properly instantiate
5
5
  def controller
6
6
  rotate_device to: :portrait, button: :bottom
7
- @controller ||= FunctionalScreen.new(nav_bar: true)
8
- @root_screen = @controller
7
+ @controller = FunctionalScreen.new(nav_bar: true)
9
8
  @controller.navigationController
10
9
  end
11
10
 
12
- after do
13
- @controller = nil
14
- @root_screen = nil
15
- end
16
-
17
11
  it "should have a navigation bar" do
18
- view("Functional").should.be.kind_of UINavigationItemView
12
+ wait 0.5 do
13
+ view("Functional").should.be.kind_of UINavigationItemView
14
+ end
19
15
  end
20
16
 
21
17
  it "should allow a string title" do
@@ -23,19 +19,19 @@ describe "ProMotion::Screen functional" do
23
19
  end
24
20
 
25
21
  it "should allow setting a left nav bar button" do
26
- @root_screen.set_nav_bar_button :left, title: "Cool", action: :triggered_button
22
+ @controller.set_nav_bar_button :left, title: "Cool", action: :triggered_button
27
23
  tap("Cool")
28
- @root_screen.button_was_triggered.should.be.true
24
+ @controller.button_was_triggered.should.be.true
29
25
  end
30
26
 
31
27
  it "should allow setting a right nav bar button" do
32
- @root_screen.set_nav_bar_button :right, title: "Cool2", action: :triggered_button
28
+ @controller.set_nav_bar_button :right, title: "Cool2", action: :triggered_button
33
29
  tap("Cool2")
34
- @root_screen.button_was_triggered.should.be.true
30
+ @controller.button_was_triggered.should.be.true
35
31
  end
36
32
 
37
33
  it "should allow opening another screen in the same nav bar and have a back button that is operational" do
38
- @root_screen.open BasicScreen
34
+ @controller.open BasicScreen
39
35
 
40
36
  wait 0.5 do
41
37
 
@@ -52,21 +48,21 @@ describe "ProMotion::Screen functional" do
52
48
  end
53
49
 
54
50
  it "should push another screen with animation by default" do
55
- basic = @root_screen.open BasicScreen
51
+ basic = @controller.open BasicScreen
56
52
  wait 0.5 do
57
53
  basic.animation_ts.should.be > 0.2
58
54
  end
59
55
  end
60
56
 
61
57
  it "should push another screen with animation when animated: true" do
62
- basic = @root_screen.open BasicScreen, animated: true
58
+ basic = @controller.open BasicScreen, animated: true
63
59
  wait 0.5 do
64
60
  basic.animation_ts.should.be > 0.2
65
61
  end
66
62
  end
67
63
 
68
64
  it "should push another screen without animation when animated: false" do
69
- basic = @root_screen.open BasicScreen, animated: false
65
+ basic = @controller.open BasicScreen, animated: false
70
66
  wait 0.5 do
71
67
  basic.animation_ts.should.be < 0.2
72
68
  end
@@ -76,7 +72,7 @@ describe "ProMotion::Screen functional" do
76
72
  it "should allow opening and closing a modal screen" do
77
73
  @basic = BasicScreen.new(nav_bar: true)
78
74
  wait 0.1 do
79
- @root_screen.open_modal @basic
75
+ @controller.open_modal @basic
80
76
 
81
77
  wait 0.6 do
82
78
 
@@ -94,7 +90,7 @@ describe "ProMotion::Screen functional" do
94
90
 
95
91
  it "should fire the will_present, on_present, will_dismiss, and on_dismiss_methods" do
96
92
  @presented_screen = PresentScreen.new
97
- @root_screen.open @presented_screen
93
+ @controller.open @presented_screen
98
94
  wait 0.6 do
99
95
  @presented_screen.will_present_fired.should == true
100
96
  @presented_screen.on_present_fired.should == true
@@ -67,14 +67,14 @@ describe "Split screen functional" do
67
67
  rotate_device to: :portrait, button: :bottom
68
68
 
69
69
  test_title = "Test Title"
70
- @controller = @app.open_split_screen @master, @detail, button_title: test_title
70
+ @alt_controller = @app.open_split_screen @master, @detail, button_title: test_title
71
71
  @detail.navigationItem.leftBarButtonItem.title.should == test_title
72
72
  end
73
73
 
74
74
  it "should override the default swipe action, that reveals the menu" do
75
75
  rotate_device to: :portrait, button: :bottom
76
76
 
77
- @controller = @app.open_split_screen @master, @detail, swipe: false
77
+ @alt_controller = @app.open_split_screen @master, @detail, swipe: false
78
78
  @app.home_screen.presentsWithGesture.should == false
79
79
  end
80
80
 
@@ -1,25 +1,32 @@
1
1
  describe "ProMotion::TestTableScreen functionality" do
2
2
  tests PM::TestTableScreen
3
3
 
4
- # Override controller to properly instantiate
4
+ def table_screen
5
+ @table_screen ||= begin
6
+ t = TestTableScreen.new(nav_bar: true)
7
+ t.on_load
8
+ t
9
+ end
10
+ end
11
+
5
12
  def controller
6
13
  rotate_device to: :portrait, button: :bottom
7
- @controller ||= TestTableScreen.new(nav_bar: true)
8
- @controller.on_load
9
- @controller.navigationController
14
+ table_screen.navigationController
10
15
  end
11
16
 
12
17
  def confirmation_class
13
18
  TestHelper.ios7 ? UITableViewCellDeleteConfirmationButton : UITableViewCellDeleteConfirmationControl
14
19
  end
15
20
 
21
+ after { @table_screen = nil }
22
+
16
23
  it "should have a navigation bar" do
17
- @controller.navigationController.should.be.kind_of(UINavigationController)
24
+ table_screen.navigationController.should.be.kind_of(UINavigationController)
18
25
  end
19
26
 
20
27
  it "should increment the tap counter on tap" do
21
28
  tap("Increment")
22
- @controller.tap_counter.should == 3
29
+ table_screen.tap_counter.should == 3
23
30
  end
24
31
 
25
32
  it "should add a new table cell on tap" do
@@ -29,34 +36,34 @@ describe "ProMotion::TestTableScreen functionality" do
29
36
 
30
37
  it "should do nothing when no action specified" do
31
38
  tap("Just another blank row")
32
- @controller.should == @controller
39
+ table_screen.should == table_screen
33
40
  end
34
41
 
35
42
  it "should increment the tap counter by one on tap" do
36
43
  tap("Increment One")
37
- @controller.tap_counter.should == 1
44
+ table_screen.tap_counter.should == 1
38
45
  end
39
46
 
40
47
  it "should delete the specified row from the table view on tap" do
41
- @controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 7
48
+ table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 7
42
49
  tap("Delete the row below")
43
50
  wait 0.3 do
44
- @controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 6
51
+ table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 6
45
52
  end
46
53
  end
47
54
 
48
55
  it "should delete the specified row from the table view on tap with an animation" do
49
- @controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 7
56
+ table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 7
50
57
  tap("Delete the row below with an animation")
51
58
  wait 0.3 do
52
- @controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 6
59
+ table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 6
53
60
  end
54
61
  end
55
62
 
56
63
  # TODO: Why is it so complicated to find the delete button??
57
64
  it "should use editing_style to delete the table row" do
58
- @controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 7
59
- @controller.cell_was_deleted.should != true
65
+ table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 7
66
+ table_screen.cell_was_deleted.should != true
60
67
  flick("Just another deletable blank row", :to => :left)
61
68
 
62
69
  wait 0.25 do
@@ -65,8 +72,8 @@ describe "ProMotion::TestTableScreen functionality" do
65
72
  if subview.class == confirmation_class
66
73
  tap subview
67
74
  wait 0.25 do
68
- @controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 6
69
- @controller.cell_was_deleted.should == true
75
+ table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 6
76
+ table_screen.cell_was_deleted.should == true
70
77
  end
71
78
  end
72
79
  end
@@ -74,8 +81,8 @@ describe "ProMotion::TestTableScreen functionality" do
74
81
  end
75
82
 
76
83
  it "should not allow deleting if on_cell_delete returns `false`" do
77
- @controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 7
78
- @controller.cell_was_deleted.should != true
84
+ table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 7
85
+ table_screen.cell_was_deleted.should != true
79
86
  flick("A non-deletable blank row", :to => :left)
80
87
 
81
88
  wait 0.25 do
@@ -84,42 +91,49 @@ describe "ProMotion::TestTableScreen functionality" do
84
91
  if subview.class == confirmation_class
85
92
  tap subview
86
93
  wait 0.25 do
87
- @controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 7
88
- @controller.cell_was_deleted.should != false
94
+ table_screen.tableView(table_screen.tableView, numberOfRowsInSection:0).should == 7
95
+ table_screen.cell_was_deleted.should != false
89
96
  end
90
97
  end
91
98
  end
92
99
  end
93
100
  end
94
101
 
95
- # Disabled by Jamon 10/16/2013 -- Bacon doesn't appear to use accessibility labels?
96
102
  it "should call a method when the switch is flipped" do
97
- # @controller.scroll_to_bottom
98
- # tap "switch_1"
99
- # wait 0.3 do
100
- # @controller.tap_counter.should == 1
101
- # end
103
+ table_screen.scroll_to_bottom
104
+ tap "switch_1"
105
+ wait 0.3 do
106
+ table_screen.tap_counter.should == 1
107
+ end
102
108
  end
103
109
 
104
110
  it "should call the method with arguments when the switch is flipped and when the cell is tapped" do
105
- # @controller.scroll_to_bottom
106
- # tap "switch_3"
107
- # wait 0.3 do
108
- # @controller.tap_counter.should == 3
111
+ table_screen.scroll_to_bottom
112
+ tap "switch_3"
113
+ wait 0.3 do
114
+ table_screen.tap_counter.should == 3
109
115
 
110
- # tap "Switch With Cell Tap, Switch Action And Parameters"
111
- # wait 0.3 do
112
- # @controller.tap_counter.should == 13
113
- # end
114
- # end
116
+ tap "Switch With Cell Tap, Switch Action And Parameters"
117
+ wait 0.3 do
118
+ table_screen.tap_counter.should == 13
119
+ end
120
+ end
115
121
  end
116
122
 
117
123
  it "should call the method with arguments when the switch is flipped" do
118
- # @controller.scroll_to_bottom
119
- # tap "switch_2"
120
- # wait 0.3 do
121
- # @controller.tap_counter.should == 3
122
- # end
124
+ table_screen.scroll_to_bottom
125
+ tap "switch_2"
126
+ wait 0.3 do
127
+ table_screen.tap_counter.should == 3
128
+ end
129
+ end
130
+
131
+ it "should not crash if cell with editing_style is swiped left" do
132
+ Proc.new { flick("Just another deletable blank row", to: :left) }.should.not.raise(StandardError)
133
+ end
134
+
135
+ it "should not crash if cell with no editing_style is swiped left" do
136
+ Proc.new { flick("Increment", to: :left) }.should.not.raise(StandardError)
123
137
  end
124
138
 
125
139
  end
@@ -4,27 +4,22 @@ describe "ProMotion::TestWebScreen functionality" do
4
4
  before { disable_network_access! }
5
5
  after { enable_network_access! }
6
6
 
7
- tests PM::TestWebScreen
8
-
9
- # Override controller to properly instantiate
10
7
  def controller
11
- rotate_device to: :portrait, button: :bottom
12
- @webscreen ||= TestWebScreen.new(nav_bar: true)
13
- @webscreen.navigationController
8
+ @controller ||= TestWebScreen.new(nav_bar: true)
14
9
  end
15
10
 
16
11
  after do
17
- @webscreen = nil
12
+ @controller = nil
18
13
  end
19
14
 
20
15
  it "should have the proper html content" do
21
16
  file_name = "WebScreen.html"
22
17
 
23
- @webscreen.set_content(file_name)
18
+ controller.set_content(file_name)
24
19
 
25
20
  @loaded_file = File.read(File.join(NSBundle.mainBundle.resourcePath, file_name))
26
- wait_for_change @webscreen, 'is_load_finished' do
27
- @webscreen.html.delete("\n").should == @loaded_file.delete("\n")
21
+ wait_for_change controller, 'is_load_finished' do
22
+ controller.html.delete("\n").should == @loaded_file.delete("\n")
28
23
  end
29
24
  end
30
25
 
@@ -32,18 +27,18 @@ describe "ProMotion::TestWebScreen functionality" do
32
27
  stub_request(:get, "https://www.google.com/").
33
28
  to_return(body: %q{Google! <form action="/search">%}, content_type: "text/html")
34
29
 
35
- @webscreen.open_url(NSURL.URLWithString("https://www.google.com/"))
36
- wait_for_change @webscreen, 'is_load_finished' do
37
- @webscreen.html.include?('<form action="/search"').should == true
30
+ controller.open_url(NSURL.URLWithString("https://www.google.com/"))
31
+ wait_for_change controller, 'is_load_finished' do
32
+ controller.html.include?('<form action="/search"').should == true
38
33
  end
39
34
  end
40
35
 
41
36
  it "should manipulate the webscreen contents with javascript" do
42
- @webscreen.set_content('<h1 id="cool">Something Cool</h1>')
37
+ controller.set_content('<h1 id="cool">Something Cool</h1>')
43
38
 
44
- wait_for_change @webscreen, 'is_load_finished' do
45
- @webscreen.evaluate('document.getElementById("cool").innerHTML = "Changed"')
46
- @webscreen.html.should =~ /<h1 id="cool">Changed<\/h1>/
39
+ wait_for_change controller, 'is_load_finished' do
40
+ controller.evaluate('document.getElementById("cool").innerHTML = "Changed"')
41
+ controller.html.should =~ /<h1 id="cool">Changed<\/h1>/
47
42
  end
48
43
 
49
44
  end