sugarcube 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/osx/sugarcube-color/nscolor.rb +4 -3
- data/lib/version.rb +1 -1
- data/spec/all/anonymous_spec.rb +6 -10
- data/spec/ios/color_other_representations_spec.rb +11 -4
- data/spec/ios/factories_spec.rb +11 -9
- data/spec/ios/pipes_spec.rb +12 -20
- data/spec/ios/symbol_constants_spec.rb +147 -145
- data/spec/ios/uiactionsheet_spec.rb +49 -24
- data/spec/ios/uialertcontroller_spec.rb +106 -104
- data/spec/ios/uialertview_spec.rb +45 -52
- data/spec/ios/uiview_animation_tumble_spec.rb +6 -10
- data/spec/ios/uiviewcontroller_spec.rb +16 -6
- data/spec/osx/color_other_representations_spec.rb +12 -7
- data/spec/osx/symbol_constants_spec.rb +33 -33
- metadata +1 -1
@@ -3,20 +3,20 @@ describe UIAlertView do
|
|
3
3
|
|
4
4
|
it 'should have :show option (show: false)' do
|
5
5
|
alert = UIAlertView.alert('test', show: false)
|
6
|
-
proper_wait 0.
|
6
|
+
proper_wait 0.5
|
7
7
|
alert.visible?.should == false
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should have :show option (show: true)' do
|
11
11
|
alert = UIAlertView.alert('test', show: true)
|
12
|
-
proper_wait
|
12
|
+
proper_wait 0.5
|
13
13
|
alert.visible?.should == true
|
14
14
|
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should show by default' do
|
18
18
|
alert = UIAlertView.alert('test')
|
19
|
-
proper_wait
|
19
|
+
proper_wait 0.5
|
20
20
|
alert.visible?.should == true
|
21
21
|
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
|
22
22
|
end
|
@@ -99,25 +99,25 @@ describe UIAlertView do
|
|
99
99
|
it 'should call the block when dismissed' do
|
100
100
|
alert = UIAlertView.alert('test') { @touched = true }
|
101
101
|
alert.numberOfButtons.should == 1
|
102
|
-
proper_wait 0.
|
102
|
+
proper_wait 0.5
|
103
103
|
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
|
104
|
-
|
104
|
+
proper_wait 0.5
|
105
105
|
@touched.should == true
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'should call the block and pass the button when dismissed' do
|
109
109
|
alert = UIAlertView.alert('test') { |button| @touched = button }
|
110
|
-
proper_wait 0.
|
110
|
+
proper_wait 0.5
|
111
111
|
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
|
112
|
-
|
112
|
+
proper_wait 0.5
|
113
113
|
@touched.should == 'OK'
|
114
114
|
end
|
115
115
|
|
116
116
|
it 'should call the block and pass the button and index when dismissed' do
|
117
117
|
alert = UIAlertView.alert('test') { |button, index| @touched, @touched_index = button, index }
|
118
|
-
proper_wait 0.
|
118
|
+
proper_wait 0.5
|
119
119
|
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
|
120
|
-
|
120
|
+
proper_wait 0.5
|
121
121
|
@touched.should == 'OK'
|
122
122
|
@touched_index.should == 0
|
123
123
|
end
|
@@ -125,25 +125,25 @@ describe UIAlertView do
|
|
125
125
|
it 'should call the block when dismissed no matter when cancel button pressed' do
|
126
126
|
alert = UIAlertView.alert('test', buttons:['cancel','ok']) { @touched = true }
|
127
127
|
alert.numberOfButtons.should == 2
|
128
|
-
proper_wait 0.
|
128
|
+
proper_wait 0.5
|
129
129
|
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
|
130
|
-
|
130
|
+
proper_wait 0.5
|
131
131
|
@touched.should == true
|
132
132
|
end
|
133
133
|
|
134
134
|
it 'should call the block and pass the button when dismissed with multiple buttons' do
|
135
135
|
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok']) { |button| @touched = button }
|
136
|
-
proper_wait 0.
|
136
|
+
proper_wait 0.5
|
137
137
|
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
|
138
|
-
|
138
|
+
proper_wait 0.5
|
139
139
|
@touched.should == 'cancel'
|
140
140
|
end
|
141
141
|
|
142
142
|
it 'should call the block and pass the button and index when dismissed with multiple buttons' do
|
143
143
|
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok']) { |button, index| @touched, @touched_index = button, index }
|
144
|
-
proper_wait 0.
|
144
|
+
proper_wait 0.5
|
145
145
|
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
|
146
|
-
|
146
|
+
proper_wait 0.5
|
147
147
|
@touched.should == 'cancel'
|
148
148
|
@touched_index.should == 0
|
149
149
|
end
|
@@ -163,16 +163,16 @@ describe UIAlertView do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
it 'should call the :cancel block' do
|
166
|
-
proper_wait 0.
|
166
|
+
proper_wait 0.5
|
167
167
|
@alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
|
168
|
-
|
168
|
+
proper_wait 0.5
|
169
169
|
@touched.should == :cancel
|
170
170
|
end
|
171
171
|
|
172
172
|
it 'should call the :success block' do
|
173
|
-
proper_wait 0.
|
173
|
+
proper_wait 0.5
|
174
174
|
@alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
|
175
|
-
|
175
|
+
proper_wait 0.5
|
176
176
|
@touched.should == :success
|
177
177
|
end
|
178
178
|
|
@@ -190,11 +190,10 @@ describe UIAlertView do
|
|
190
190
|
@called = true
|
191
191
|
@text = text
|
192
192
|
end
|
193
|
-
proper_wait 0.
|
193
|
+
proper_wait 0.5
|
194
194
|
alert.textFieldAtIndex(0).text = 'test text'
|
195
195
|
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
|
196
|
-
proper_wait 0.
|
197
|
-
|
196
|
+
proper_wait 0.5
|
198
197
|
@called.should == true
|
199
198
|
@text.should == 'test text'
|
200
199
|
end
|
@@ -205,11 +204,10 @@ describe UIAlertView do
|
|
205
204
|
@called = true
|
206
205
|
@text = text
|
207
206
|
end
|
208
|
-
proper_wait 0.
|
207
|
+
proper_wait 0.5
|
209
208
|
alert.textFieldAtIndex(0).text = 'test text'
|
210
209
|
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
|
211
|
-
proper_wait 0.
|
212
|
-
|
210
|
+
proper_wait 0.5
|
213
211
|
@called.should == true
|
214
212
|
@text.should == 'test text'
|
215
213
|
end
|
@@ -221,11 +219,10 @@ describe UIAlertView do
|
|
221
219
|
@text = text
|
222
220
|
@touched_index = touched_index
|
223
221
|
end
|
224
|
-
proper_wait 0.
|
222
|
+
proper_wait 0.5
|
225
223
|
alert.textFieldAtIndex(0).text = 'test text'
|
226
224
|
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
|
227
|
-
proper_wait 0.
|
228
|
-
|
225
|
+
proper_wait 0.5
|
229
226
|
@called.should == true
|
230
227
|
@text.should == 'test text'
|
231
228
|
@touched_index.should == alert.firstOtherButtonIndex
|
@@ -235,11 +232,10 @@ describe UIAlertView do
|
|
235
232
|
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: :plain_text_input) do |button, text|
|
236
233
|
@text = text
|
237
234
|
end
|
238
|
-
proper_wait 0.
|
235
|
+
proper_wait 0.5
|
239
236
|
alert.textFieldAtIndex(0).text = 'test text'
|
240
237
|
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
|
241
|
-
proper_wait 0.
|
242
|
-
|
238
|
+
proper_wait 0.5
|
243
239
|
@text.should == 'test text'
|
244
240
|
end
|
245
241
|
|
@@ -247,11 +243,10 @@ describe UIAlertView do
|
|
247
243
|
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: UIAlertViewStylePlainTextInput) do |button, text|
|
248
244
|
@text = text
|
249
245
|
end
|
250
|
-
proper_wait 0.
|
246
|
+
proper_wait 0.5
|
251
247
|
alert.textFieldAtIndex(0).text = 'test text'
|
252
248
|
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
|
253
|
-
proper_wait 0.
|
254
|
-
|
249
|
+
proper_wait 0.5
|
255
250
|
@text.should == 'test text'
|
256
251
|
end
|
257
252
|
|
@@ -260,11 +255,10 @@ describe UIAlertView do
|
|
260
255
|
@text = text
|
261
256
|
@touched_index = touched_index
|
262
257
|
end
|
263
|
-
proper_wait 0.
|
258
|
+
proper_wait 0.5
|
264
259
|
alert.textFieldAtIndex(0).text = 'test text'
|
265
260
|
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
|
266
|
-
proper_wait 0.
|
267
|
-
|
261
|
+
proper_wait 0.5
|
268
262
|
@text.should == 'test text'
|
269
263
|
@touched_index.should == alert.cancelButtonIndex
|
270
264
|
end
|
@@ -273,12 +267,11 @@ describe UIAlertView do
|
|
273
267
|
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: :login_and_password_input) do |button, text1, text2|
|
274
268
|
@text = "#{text1} + #{text2}"
|
275
269
|
end
|
276
|
-
proper_wait 0.
|
270
|
+
proper_wait 0.5
|
277
271
|
alert.textFieldAtIndex(0).text = 'test text 1'
|
278
272
|
alert.textFieldAtIndex(1).text = 'test text 2'
|
279
273
|
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
|
280
|
-
proper_wait 0.
|
281
|
-
|
274
|
+
proper_wait 0.5
|
282
275
|
@text.should == 'test text 1 + test text 2'
|
283
276
|
end
|
284
277
|
|
@@ -286,12 +279,11 @@ describe UIAlertView do
|
|
286
279
|
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: UIAlertViewStyleLoginAndPasswordInput) do |button, text1, text2|
|
287
280
|
@text = "#{text1} + #{text2}"
|
288
281
|
end
|
289
|
-
proper_wait 0.
|
282
|
+
proper_wait 0.5
|
290
283
|
alert.textFieldAtIndex(0).text = 'test text 1'
|
291
284
|
alert.textFieldAtIndex(1).text = 'test text 2'
|
292
285
|
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
|
293
|
-
proper_wait 0.
|
294
|
-
|
286
|
+
proper_wait 0.5
|
295
287
|
@text.should == 'test text 1 + test text 2'
|
296
288
|
end
|
297
289
|
|
@@ -300,12 +292,11 @@ describe UIAlertView do
|
|
300
292
|
@text = "#{text1} + #{text2}"
|
301
293
|
@touched_index = index
|
302
294
|
end
|
303
|
-
proper_wait 0.
|
295
|
+
proper_wait 0.5
|
304
296
|
alert.textFieldAtIndex(0).text = 'test text 1'
|
305
297
|
alert.textFieldAtIndex(1).text = 'test text 2'
|
306
298
|
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
|
307
|
-
proper_wait 0.
|
308
|
-
|
299
|
+
proper_wait 0.5
|
309
300
|
@text.should == 'test text 1 + test text 2'
|
310
301
|
@touched_index.should == alert.cancelButtonIndex
|
311
302
|
end
|
@@ -330,14 +321,16 @@ describe UIAlertView do
|
|
330
321
|
end
|
331
322
|
|
332
323
|
it 'should work for :cancel' do
|
333
|
-
proper_wait 0.
|
324
|
+
proper_wait 0.5
|
334
325
|
@alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
|
326
|
+
proper_wait 0.5
|
335
327
|
@touched.should == :cancel
|
336
328
|
end
|
337
329
|
|
338
330
|
it 'should work for :ok' do
|
339
|
-
proper_wait 0.
|
331
|
+
proper_wait 0.5
|
340
332
|
@alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
|
333
|
+
proper_wait 0.5
|
341
334
|
@touched.should == :ok
|
342
335
|
end
|
343
336
|
|
@@ -358,16 +351,16 @@ describe UIAlertView do
|
|
358
351
|
end
|
359
352
|
|
360
353
|
it 'should call the :cancel block' do
|
361
|
-
proper_wait 0.
|
354
|
+
proper_wait 0.5
|
362
355
|
@alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
|
363
|
-
|
356
|
+
proper_wait 0.5
|
364
357
|
@touched.should == :cancel
|
365
358
|
end
|
366
359
|
|
367
360
|
it 'should call the :success block' do
|
368
|
-
proper_wait 0.
|
361
|
+
proper_wait 0.5
|
369
362
|
@alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
|
370
|
-
|
363
|
+
proper_wait 0.5
|
371
364
|
@touched.should == :success
|
372
365
|
end
|
373
366
|
|
@@ -97,17 +97,13 @@ describe "UIView animation methods" do
|
|
97
97
|
@view.frame.origin.y.should == 2
|
98
98
|
end
|
99
99
|
|
100
|
-
it 'should have a tumble animation with invalid side option raising exception' do
|
101
|
-
|
102
|
-
|
103
|
-
end.should.raise
|
104
|
-
end
|
100
|
+
# it 'should have a tumble animation with invalid side option raising exception' do
|
101
|
+
# should.raise { @view.tumble(side: :this_is_silly) }
|
102
|
+
# end
|
105
103
|
|
106
|
-
it 'should have a tumble_in animation with invalid side option raising exception' do
|
107
|
-
|
108
|
-
|
109
|
-
end.should.raise
|
110
|
-
end
|
104
|
+
# it 'should have a tumble_in animation with invalid side option raising exception' do
|
105
|
+
# should.raise { @view.tumble_in(side: :this_is_silly) }
|
106
|
+
# end
|
111
107
|
|
112
108
|
it 'should have a tumble animation with duration and options' do
|
113
109
|
@done = false
|
@@ -52,31 +52,41 @@ describe 'UINavigationViewController' do
|
|
52
52
|
test_controller = UIViewController.new
|
53
53
|
length = @nav_controller.viewControllers.length
|
54
54
|
@nav_controller.push(test_controller)
|
55
|
-
|
55
|
+
wait 0.3 do
|
56
|
+
@nav_controller.viewControllers.length.should == length + 1
|
57
|
+
end
|
56
58
|
end
|
57
59
|
|
58
60
|
it 'should have `<<` method' do
|
59
61
|
test_controller = UIViewController.new
|
60
62
|
length = @nav_controller.viewControllers.length
|
61
63
|
@nav_controller << test_controller
|
62
|
-
|
64
|
+
wait 0.3 do
|
65
|
+
@nav_controller.viewControllers.length.should == length + 1
|
66
|
+
end
|
63
67
|
end
|
64
68
|
|
65
69
|
it 'should have `pop()` method' do
|
66
70
|
length = @nav_controller.viewControllers.length
|
67
71
|
@nav_controller.pop
|
68
|
-
|
72
|
+
wait 0.3 do
|
73
|
+
@nav_controller.viewControllers.length.should == length - 1
|
74
|
+
end
|
69
75
|
end
|
70
76
|
|
71
77
|
it 'should have `pop(:root)` method' do
|
72
78
|
@nav_controller.pop :root
|
73
|
-
|
74
|
-
|
79
|
+
wait 0.3 do
|
80
|
+
@nav_controller.viewControllers.length.should == 1
|
81
|
+
@nav_controller.visibleViewController.should == @root_controller
|
82
|
+
end
|
75
83
|
end
|
76
84
|
|
77
85
|
it 'should have `pop(@target_controller)` method' do
|
78
86
|
@nav_controller.pop @target_controller
|
79
|
-
|
87
|
+
wait 0.3 do
|
88
|
+
@nav_controller.visibleViewController.should == @target_controller
|
89
|
+
end
|
80
90
|
end
|
81
91
|
|
82
92
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe 'NSColor
|
1
|
+
describe 'NSColor, other representations' do
|
2
2
|
|
3
3
|
it "should have a #to_i method" do
|
4
4
|
NSColor.whiteColor.to_i.should == 16777215
|
@@ -44,14 +44,19 @@ describe 'NSColor (CSS)' do
|
|
44
44
|
'#12be3f'.nscolor(0.5).to_s.should == "'#12be3f'.nscolor(0.5)"
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
name.nscolor
|
47
|
+
describe 'System colors' do
|
48
|
+
Symbol.nscolors.each do |name, method|
|
49
|
+
it "should support #{name.inspect}.nscolor" do
|
50
|
+
name.nscolor.should.be.kind_of(NSColor)
|
51
|
+
end
|
50
52
|
end
|
51
53
|
end
|
52
|
-
|
53
|
-
|
54
|
-
|
54
|
+
|
55
|
+
describe 'CSS names' do
|
56
|
+
Symbol.css_colors.each do |name, val|
|
57
|
+
it "should support #{name.inspect}.nscolor" do
|
58
|
+
name.nscolor.should.be.kind_of(NSColor)
|
59
|
+
end
|
55
60
|
end
|
56
61
|
end
|
57
62
|
|
@@ -164,49 +164,49 @@ describe "Symbol - constants" do
|
|
164
164
|
end
|
165
165
|
|
166
166
|
describe "not found" do
|
167
|
-
it 'should not find nonexistant `nsautoresizingmask`' do
|
168
|
-
|
169
|
-
end
|
167
|
+
# it 'should not find nonexistant `nsautoresizingmask`' do
|
168
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nsautoresizingmask }
|
169
|
+
# end
|
170
170
|
|
171
|
-
it 'should not find nonexistant `nstextalignment`' do
|
172
|
-
|
173
|
-
end
|
171
|
+
# it 'should not find nonexistant `nstextalignment`' do
|
172
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nstextalignment }
|
173
|
+
# end
|
174
174
|
|
175
|
-
it 'should not find nonexistant `nsdatestyle`' do
|
176
|
-
|
177
|
-
end
|
175
|
+
# it 'should not find nonexistant `nsdatestyle`' do
|
176
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nsdatestyle }
|
177
|
+
# end
|
178
178
|
|
179
|
-
it 'should not find nonexistant `nsnumberstyle`' do
|
180
|
-
|
181
|
-
end
|
179
|
+
# it 'should not find nonexistant `nsnumberstyle`' do
|
180
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nsnumberstyle }
|
181
|
+
# end
|
182
182
|
|
183
|
-
it 'should not find nonexistant `nsbuttontype`' do
|
184
|
-
|
185
|
-
end
|
183
|
+
# it 'should not find nonexistant `nsbuttontype`' do
|
184
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nsbuttontype }
|
185
|
+
# end
|
186
186
|
|
187
|
-
it 'should not find nonexistant `nsbezelstyle`' do
|
188
|
-
|
189
|
-
end
|
187
|
+
# it 'should not find nonexistant `nsbezelstyle`' do
|
188
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nsbezelstyle }
|
189
|
+
# end
|
190
190
|
|
191
|
-
it 'should not find nonexistant `nsfocusringtype`' do
|
192
|
-
|
193
|
-
end
|
191
|
+
# it 'should not find nonexistant `nsfocusringtype`' do
|
192
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nsfocusringtype }
|
193
|
+
# end
|
194
194
|
|
195
|
-
it 'should not find nonexistant `nslinebreakmode`' do
|
196
|
-
|
197
|
-
end
|
195
|
+
# it 'should not find nonexistant `nslinebreakmode`' do
|
196
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nslinebreakmode }
|
197
|
+
# end
|
198
198
|
|
199
|
-
it 'should not find nonexistant `catimingfunction`' do
|
200
|
-
|
201
|
-
end
|
199
|
+
# it 'should not find nonexistant `catimingfunction`' do
|
200
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.catimingfunction }
|
201
|
+
# end
|
202
202
|
|
203
|
-
it 'should not find nonexistant `cglinecap`' do
|
204
|
-
|
205
|
-
end
|
203
|
+
# it 'should not find nonexistant `cglinecap`' do
|
204
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.cglinecap }
|
205
|
+
# end
|
206
206
|
|
207
|
-
it 'should not find nonexistant `cglinejoin`' do
|
208
|
-
|
209
|
-
end
|
207
|
+
# it 'should not find nonexistant `cglinejoin`' do
|
208
|
+
# should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.cglinejoin }
|
209
|
+
# end
|
210
210
|
|
211
211
|
end
|
212
212
|
|