jquids 0.2.1

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.
@@ -0,0 +1,649 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'open-uri'
3
+
4
+ describe Jquids::IncludesHelper do
5
+
6
+ include ActionView::Helpers::TagHelper
7
+ include ActionView::Helpers::AssetTagHelper
8
+ include Jquids::IncludesHelper
9
+
10
+ before(:each) do
11
+ Jquids.instance_variable_set :@jquids_format, nil
12
+ end
13
+
14
+ describe "The jq_ui_default_stylesheet function" do
15
+
16
+ describe "with no args" do
17
+
18
+ it "should return 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/base/jquery-ui.css'" do
19
+ jq_ui_stylesheet.should == "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/base/jquery-ui.css"
20
+ end
21
+
22
+ end
23
+
24
+ describe "with a args (:unknown_style) that doesn't exist" do
25
+
26
+ it "should raise a Jquids::NoStyleFoundError" do
27
+ expect{ jq_ui_stylesheet :unknown_style }.to raise_error(Jquids::NotAKnownStyle, "Jquids: Unrecognized style specification: unknown_style")
28
+ end
29
+
30
+ end
31
+
32
+ Jquids::STYLES.each do |style|
33
+
34
+ describe "with args of #{style[0]}" do
35
+
36
+ it "should return 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/#{style[1]}/jquery-ui.css'" do
37
+ jq_ui_stylesheet(style[0]).should == "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/#{style[1]}/jquery-ui.css"
38
+ end
39
+
40
+ #it "should curl and return the jQuery css header comment" do
41
+ #f = open("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/#{style[1]}/jquery-ui.css")
42
+ #f.first.should == "/*\n"
43
+ #f.first.should == " * jQuery UI CSS Framework 1.8.13\n"
44
+ #f.first.should == " *\n"
45
+ #f.first.should == " * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)\n"
46
+ #f.first.should == " * Dual licensed under the MIT or GPL Version 2 licenses.\n"
47
+ #f.first.should == " * http://jquery.org/license\n"
48
+ #f.first.should == " *\n"
49
+ #f.first.should == " * http://docs.jquery.com/UI/Theming/API\n"
50
+ #f.first.should == " */\n"
51
+ #end
52
+
53
+ end
54
+
55
+ end
56
+
57
+ end
58
+
59
+ describe "The jq_ui_javascripts function" do
60
+
61
+ describe "where jq" do
62
+
63
+ describe "equals latest version" do
64
+
65
+ it "does include 'https://ajax.googleapis.com/ajax/libs/jquery/'" do
66
+ jq_ui_javascripts(Jquids::JQVersions.last, Jquids::UIVersions.last, Jquids::TimepickerTags.last).select {|x| x =~ /https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\//}.should_not == []
67
+ end
68
+
69
+ end
70
+
71
+ describe "equals :none" do
72
+
73
+ it "doesn't include 'https://ajax.googleapis.com/ajax/libs/jquery/'" do
74
+ jq_ui_javascripts(:none, Jquids::UIVersions.last, Jquids::TimepickerTags.last).select {|x| x =~ /https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\//}.should == []
75
+ end
76
+
77
+ end
78
+
79
+ describe "equals nil" do
80
+
81
+ it "doesn't include 'https://ajax.googleapis.com/ajax/libs/jquery/'" do
82
+ jq_ui_javascripts(nil, Jquids::UIVersions.last, Jquids::TimepickerTags.last).select {|x| x =~ /https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\//}.should == []
83
+ end
84
+
85
+ end
86
+
87
+ describe "equals false" do
88
+
89
+ it "doesn't include 'https://ajax.googleapis.com/ajax/libs/jquery/'" do
90
+ jq_ui_javascripts(false, Jquids::UIVersions.last, Jquids::TimepickerTags.last).select {|x| x =~ /https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\//}.should == []
91
+ end
92
+
93
+ end
94
+
95
+ Jquids::JQVersions.each do |v|
96
+
97
+ describe "equals '#{v}'" do
98
+
99
+ it "includes 'https://ajax.googleapis.com/ajax/libs/jquery/#{v}/jquery.min.js'" do
100
+ jq_ui_javascripts(v, Jquids::UIVersions.last, Jquids::TimepickerTags.last).should include("https://ajax.googleapis.com/ajax/libs/jquery/#{v}/jquery.min.js")
101
+ end
102
+
103
+ end
104
+
105
+ end
106
+
107
+ describe "equals '9001'" do
108
+
109
+ it "includes 'https://ajax.googleapis.com/ajax/libs/jquery/#{Jquids::JQVersions.last}/jquery.min.js'" do
110
+ jq_ui_javascripts('9001', Jquids::UIVersions.last, Jquids::TimepickerTags.last).should include("https://ajax.googleapis.com/ajax/libs/jquery/#{Jquids::JQVersions.last}/jquery.min.js")
111
+ end
112
+
113
+ end
114
+
115
+ end
116
+
117
+ describe "where ui" do
118
+
119
+ describe "equals :none" do
120
+
121
+ it "does include 'https://ajax.googleapis.com/ajax/libs/jqueryui/'" do
122
+ jq_ui_javascripts(Jquids::JQVersions.last, Jquids::UIVersions.last, Jquids::TimepickerTags.last).select {|x| x =~ /https:\/\/ajax.googleapis.com\/ajax\/libs\/jqueryui\//}.should_not == []
123
+ end
124
+
125
+ end
126
+
127
+ describe "equals :none" do
128
+
129
+ it "doesn't include 'https://ajax.googleapis.com/ajax/libs/jqueryui/'" do
130
+ jq_ui_javascripts(Jquids::JQVersions.last, :none, Jquids::TimepickerTags.last).select {|x| x =~ /https:\/\/ajax.googleapis.com\/ajax\/libs\/jqueryui\//}.should == []
131
+ end
132
+
133
+ end
134
+
135
+ describe "equals nil" do
136
+
137
+ it "doesn't include 'https://ajax.googleapis.com/ajax/libs/jqueryui/'" do
138
+ jq_ui_javascripts(Jquids::JQVersions.last, nil, Jquids::TimepickerTags.last).select {|x| x =~ /https:\/\/ajax.googleapis.com\/ajax\/libs\/jqueryui\//}.should == []
139
+ end
140
+
141
+ end
142
+
143
+ describe "equals false" do
144
+
145
+ it "doesn't include 'https://ajax.googleapis.com/ajax/libs/jqueryui/'" do
146
+ jq_ui_javascripts(Jquids::JQVersions.last, false, Jquids::TimepickerTags.last).select {|x| x =~ /https:\/\/ajax.googleapis.com\/ajax\/libs\/jqueryui\//}.should == []
147
+ end
148
+
149
+ end
150
+
151
+ Jquids::UIVersions.each do |v|
152
+ describe "equals '#{v}'" do
153
+
154
+ it "includes 'https://ajax.googleapis.com/ajax/libs/jqueryui/#{v}/jquery-ui.min.js'" do
155
+ jq_ui_javascripts(Jquids::UIVersions.last, v, Jquids::TimepickerTags.last).should include("https://ajax.googleapis.com/ajax/libs/jqueryui/#{v}/jquery-ui.min.js")
156
+ end
157
+
158
+ end
159
+
160
+ end
161
+
162
+ describe "equals '9001'" do
163
+
164
+ it "includes 'https://ajax.googleapis.com/ajax/libs/jqueryui/#{Jquids::UIVersions.last}/jquery-ui.min.js'" do
165
+ jq_ui_javascripts(Jquids::UIVersions.last, 9001, Jquids::TimepickerTags.last).should include("https://ajax.googleapis.com/ajax/libs/jqueryui/#{Jquids::UIVersions.last}/jquery-ui.min.js")
166
+ end
167
+
168
+ end
169
+
170
+ end
171
+
172
+ describe "where timepicker" do
173
+
174
+ describe "equals the latest version" do
175
+
176
+ it "does includes 'https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/'" do
177
+ jq_ui_javascripts(Jquids::UIVersions.last, Jquids::UIVersions.last, Jquids::TimepickerTags.last).select {|x| x =~ /https:\/\/raw.github.com\/trentrichardson\/jQuery-Timepicker-Addon\//}.should_not == []
178
+ end
179
+
180
+ end
181
+
182
+ describe "equals :none" do
183
+
184
+ it "doesn't includes 'https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/'" do
185
+ jq_ui_javascripts(Jquids::UIVersions.last, Jquids::UIVersions.last, :none).select {|x| x =~ /https:\/\/raw.github.com\/trentrichardson\/jQuery-Timepicker-Addon\//}.should == []
186
+ end
187
+
188
+ end
189
+
190
+ describe "equals false" do
191
+
192
+ it "doesn't includes 'https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/'" do
193
+ jq_ui_javascripts(Jquids::UIVersions.last, Jquids::UIVersions.last, false).select {|x| x =~ /https:\/\/raw.github.com\/trentrichardson\/jQuery-Timepicker-Addon\//}.should == []
194
+ end
195
+
196
+ end
197
+
198
+ describe "equals nil" do
199
+
200
+ it "doesn't includes 'https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/'" do
201
+ jq_ui_javascripts(Jquids::UIVersions.last, Jquids::UIVersions.last, nil).select {|x| x =~ /https:\/\/raw.github.com\/trentrichardson\/jQuery-Timepicker-Addon\//}.should == []
202
+ end
203
+
204
+ end
205
+
206
+ Jquids::TimepickerTags.each do |v|
207
+ describe "equals '#{v}'" do
208
+
209
+ it "includes 'https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/#{v}/jquery-ui-timepicker-addon.js'" do
210
+ jq_ui_javascripts(Jquids::UIVersions.last, Jquids::UIVersions.last, v).should include("https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/#{v}/jquery-ui-timepicker-addon.js")
211
+ end
212
+
213
+ end
214
+
215
+ end
216
+
217
+ describe "equals '9001'" do
218
+
219
+ it "includes 'https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/#{Jquids::TimepickerTags.last}/jquery-ui-timepicker-addon.js'" do
220
+ jq_ui_javascripts(Jquids::UIVersions.last, Jquids::UIVersions.last, 9001).should include("https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/#{Jquids::TimepickerTags.last}/jquery-ui-timepicker-addon.js")
221
+ end
222
+
223
+ end
224
+
225
+ end
226
+
227
+ end
228
+
229
+ describe "The jquids_includes function" do
230
+
231
+ it "has a javascript tag for jQuery" do
232
+ jquids_includes.should include("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js\" type=\"text/javascript\"></script>")
233
+ end
234
+
235
+ it "has a javascript tag for jQuery UI" do
236
+ jquids_includes.should include("<script src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js\" type=\"text/javascript\"></script>")
237
+ end
238
+
239
+ it "has the options parsing script" do
240
+ jquids_includes.should include('$(document).ready(function(){$(".jquids_dp").each(function(){var s=$(this).attr("data-jquipicker");$(this).attr("data-jquipicker")?$(this).datepicker(JSON.parse(s)):$(this).datepicker()});$(".jquids_tp").each(function(){var s=$(this).attr("data-jquipicker");$(this).attr("data-jquipicker")?$(this).timepicker(JSON.parse(s)):$(this).timepicker()});$(".jquids_dtp").each(function(){var s=$(this).attr("data-jquipicker");$(this).attr("data-jquipicker")?$(this).datetimepicker(JSON.parse(s)):$(this).datetimepicker()})});</script>')
241
+ end
242
+
243
+ it "has the datepicker.setDefaults javascript function" do
244
+ jquids_includes.should include("<script type=\"text/javascript\">$.datepicker.setDefaults({")
245
+ end
246
+
247
+ it "does not have the timepicker.setDefaults javascript function" do
248
+ jquids_includes.should_not include("$.timepicker.setDefaults({")
249
+ end
250
+
251
+ it "does not have the timepicker css" do
252
+ jquids_includes().should_not include('<style type="text/css">.ui-timepicker-div .ui-widget-header{margin-bottom:8px;}.ui-timepicker-div dl{text-align:left;}.ui-timepicker-div dl dt{height:25px;}.ui-timepicker-div dl dd{margin:-25px 0 10px 65px;}.ui-timepicker-div td{font-size:90%;}</style>')
253
+ end
254
+
255
+ describe "without datepicker_options" do
256
+
257
+ it "has changeMonth set to true" do
258
+ jquids_includes.should include('"changeMonth":true')
259
+ end
260
+
261
+ it "has changeYear set to true" do
262
+ jquids_includes.should include('"changeYear":true')
263
+ end
264
+
265
+ it "has showOtherMonths set to true" do
266
+ jquids_includes.should include('"showOtherMonths":true')
267
+ end
268
+
269
+ it "has selectOtherMonths set to true" do
270
+ jquids_includes.should include('"selectOtherMonths":true')
271
+ end
272
+
273
+ it "has dateFormat set to ':natural'" do
274
+ jquids_includes.should include('"dateFormat":"MM dd, yy"')
275
+ end
276
+
277
+ end
278
+
279
+ describe "without timepicker_options" do
280
+
281
+ it "does not have timeFormat set to ':natural'" do
282
+ jquids_includes.should_not include('"timeFormat":"hh:mm TT"')
283
+ end
284
+
285
+ it "does not have ampm set to true" do
286
+ jquids_includes.should_not include('"ampm":true')
287
+ end
288
+
289
+ end
290
+
291
+ describe "without timepicker_options but :TRTimepicker => v0.9.5" do
292
+
293
+ it "returns timeFormat set to ':natural'" do
294
+ jquids_includes(:TRTimepicker => "v0.9.5").should include('"timeFormat":"hh:mm TT"')
295
+ end
296
+
297
+ it "returns ampm set to true" do
298
+ jquids_includes(:TRTimepicker => "v0.9.5").should include('"ampm":true')
299
+ end
300
+
301
+ it "returns the timepicker css" do
302
+ jquids_includes(:TRTimepicker => "v0.9.5").should include('<style type="text/css">.ui-timepicker-div .ui-widget-header{margin-bottom:8px;}.ui-timepicker-div dl{text-align:left;}.ui-timepicker-div dl dt{height:25px;}.ui-timepicker-div dl dd{margin:-25px 0 10px 65px;}.ui-timepicker-div td{font-size:90%;}</style>')
303
+ end
304
+
305
+ end
306
+
307
+ describe "without datepicker_options or timepicker_options and the format is set to finnish" do
308
+
309
+ before(:each) do
310
+ Jquids.format = :finnish
311
+ end
312
+
313
+ it "has changeMonth set to true" do
314
+ jquids_includes.should include('"changeMonth":true')
315
+ end
316
+
317
+ it "has changeYear set to true" do
318
+ jquids_includes.should include('"changeYear":true')
319
+ end
320
+
321
+ it "has showOtherMonths set to true" do
322
+ jquids_includes.should include('"showOtherMonths":true')
323
+ end
324
+
325
+ it "has selectOtherMonths set to true" do
326
+ jquids_includes.should include('"selectOtherMonths":true')
327
+ end
328
+
329
+ it "has dateFormat set to ':finnish'" do
330
+ jquids_includes.should include('"dateFormat":"dd.mm.yy"')
331
+ end
332
+
333
+ describe "with :TRTimepicker => 'v0.9.7'" do
334
+
335
+ it "has timeFormat set to ':finish'" do
336
+ jquids_includes(:TRTimepicker => "v0.9.5").should include('"timeFormat":"hh:mm"')
337
+ end
338
+
339
+ it "has ampm set to true" do
340
+ jquids_includes(:TRTimepicker => "v0.9.5").should include('"ampm":false')
341
+ end
342
+
343
+ it "returns the timepicker css" do
344
+ jquids_includes(:TRTimepicker => "v0.9.5").should include('<style type="text/css">.ui-timepicker-div .ui-widget-header{margin-bottom:8px;}.ui-timepicker-div dl{text-align:left;}.ui-timepicker-div dl dt{height:25px;}.ui-timepicker-div dl dd{margin:-25px 0 10px 65px;}.ui-timepicker-div td{font-size:90%;}</style>')
345
+ end
346
+
347
+ end
348
+
349
+ end
350
+
351
+ describe "without datepicker_options and the format is set to finnish using the function itself" do
352
+
353
+ before(:each) do
354
+ @output = jquids_includes(:format => :finnish)
355
+ end
356
+
357
+ it "has changeMonth set to true" do
358
+ @output.should include('"changeMonth":true')
359
+ end
360
+
361
+ it "has changeYear set to true" do
362
+ @output.should include('"changeYear":true')
363
+ end
364
+
365
+ it "has showOtherMonths set to true" do
366
+ @output.should include('"showOtherMonths":true')
367
+ end
368
+
369
+ it "has selectOtherMonths set to true" do
370
+ @output.should include('"selectOtherMonths":true')
371
+ end
372
+
373
+ it "has dateFormat set to ':finnish'" do
374
+ @output.should include('"dateFormat":"dd.mm.yy"')
375
+ end
376
+
377
+ describe "with :TRTimepicker => 'v0.9.7'" do
378
+
379
+ before(:each) do
380
+ @output = jquids_includes(:format => :finnish, :TRTimepicker => "v0.9.5")
381
+ end
382
+
383
+ it "has timeFormat set to ':finish'" do
384
+ @output.should include('"timeFormat":"hh:mm"')
385
+ end
386
+
387
+ it "has ampm set to true" do
388
+ @output.should include('"ampm":false')
389
+ end
390
+
391
+ end
392
+
393
+ end
394
+
395
+ describe "with datepicker_options" do
396
+
397
+ describe "of {:datepicker_options => {:autoSize => true}}" do
398
+
399
+ it "has changeMonth set to true" do
400
+ jquids_includes(:datepicker_options => {:autoSize => true}).should include('"changeMonth":true')
401
+ end
402
+
403
+ it "has changeYear set to true" do
404
+ jquids_includes(:datepicker_options => {:autoSize => true}).should include('"changeYear":true')
405
+ end
406
+
407
+ it "has showOtherMonths set to true" do
408
+ jquids_includes(:datepicker_options => {:autoSize => true}).should include('"showOtherMonths":true')
409
+ end
410
+
411
+ it "has selectOtherMonths set to true" do
412
+ jquids_includes(:datepicker_options => {:autoSize => true}).should include('"selectOtherMonths":true')
413
+ end
414
+
415
+ it "has autoSize set to true" do
416
+ jquids_includes(:datepicker_options => {:autoSize => true}).should include('"autoSize":true')
417
+ end
418
+
419
+ it "has dateFormat set to ':natural'" do
420
+ jquids_includes(:datepicker_options => {:autoSize => true}).should include('"dateFormat":"MM dd, yy"')
421
+ end
422
+
423
+ end
424
+
425
+ describe "overwriting the defaults" do
426
+
427
+ before(:each) do
428
+ @options = {:datepicker_options => {:changeMonth => false,
429
+ :changeYear => false,
430
+ :showOtherMonths => false,
431
+ :selectOtherMonths => false}}
432
+ end
433
+
434
+ it "has changeMonth set to false" do
435
+ jquids_includes(@options).should include('"changeMonth":false')
436
+ end
437
+
438
+ it "has changeYear set to false" do
439
+ jquids_includes(@options).should include('"changeYear":false')
440
+ end
441
+
442
+ it "has showOtherMonths set to false" do
443
+ jquids_includes(@options).should include('"showOtherMonths":false')
444
+ end
445
+
446
+ it "has selectOtherMonths set to false" do
447
+ jquids_includes(@options).should include('"selectOtherMonths":false')
448
+ end
449
+
450
+ it "has dateFormat set to ':natural'" do
451
+ jquids_includes(@options).should include('"dateFormat":"MM dd, yy"')
452
+ end
453
+
454
+ end
455
+
456
+ end
457
+
458
+ describe "with CalendarDateSelect style options" do
459
+
460
+ describe "of :year_range => 2000..2020" do
461
+
462
+ it "has changeMonth set to true" do
463
+ jquids_includes(:year_range => 2000..2020).should include('"changeMonth":true')
464
+ end
465
+
466
+ it "has changeYear set to true" do
467
+ jquids_includes(:year_range => 2000..2020).should include('"changeYear":true')
468
+ end
469
+
470
+ it "has showOtherMonths set to true" do
471
+ jquids_includes(:year_range => 2000..2020).should include('"showOtherMonths":true')
472
+ end
473
+
474
+ it "has selectOtherMonths set to true" do
475
+ jquids_includes(:year_range => 2000..2020).should include('"selectOtherMonths":true')
476
+ end
477
+
478
+ it "has autoSize set to true" do
479
+ jquids_includes(:year_range => 2000..2020).should include('"yearRange":"2000:2020"')
480
+ end
481
+
482
+ it "has dateFormat set to ':natural'" do
483
+ jquids_includes(:year_range => 2000..2020).should include('"dateFormat":"MM dd, yy"')
484
+ end
485
+
486
+ end
487
+
488
+ end
489
+
490
+ describe "with no args" do
491
+
492
+ it "has the :base stylesheet link tag" do
493
+ jquids_includes.should include("<link href=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/base/jquery-ui.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />")
494
+ end
495
+
496
+ end
497
+
498
+ Jquids::JQVersions.each do |v|
499
+ describe "with args of {:jQuery => '#{v}'}" do
500
+
501
+ it "has no jQuery javascript link tag" do
502
+ jquids_includes(:jQuery => v).should include("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/#{v}/jquery.min.js\" type=\"text/javascript\"></script>")
503
+ end
504
+
505
+ end
506
+ end
507
+
508
+
509
+ describe "with args of {:jQuery => :none}" do
510
+
511
+ it "has no jQuery javascript link tag" do
512
+ jquids_includes(:jQuery => :none).should_not include("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/")
513
+ end
514
+
515
+ end
516
+
517
+ describe "with args of {:jQuery => nil}" do
518
+
519
+ it "has no jQuery javascript link tag" do
520
+ jquids_includes(:jQuery => nil).should_not include("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/")
521
+ end
522
+
523
+ end
524
+
525
+ describe "with args of {:jQuery => false}" do
526
+
527
+ it "has no jQuery javascript link tag" do
528
+ jquids_includes(:jQuery => false).should_not include("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/")
529
+ end
530
+
531
+ end
532
+
533
+ Jquids::UIVersions.each do |v|
534
+ describe "with args of {:jQueryUI => '#{v}'}" do
535
+
536
+ it "has jQuery UI javascript link tag with a version of '#{v}'" do
537
+ jquids_includes(:jQueryUI => v).should include("<script src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/#{v}/jquery-ui.min.js\" type=\"text/javascript\"></script>")
538
+ end
539
+
540
+ end
541
+ end
542
+
543
+ describe "with args of {:jQueryUI => :none}" do
544
+
545
+ it "has no jQuery UI javascript link tag" do
546
+ jquids_includes(:jQueryUI => :none).should_not include("<script src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/")
547
+ end
548
+
549
+ end
550
+
551
+ describe "with args of {:jQueryUI => nil}" do
552
+
553
+ it "has no jQuery UI javascript link tag" do
554
+ jquids_includes(:jQueryUI => nil).should_not include("<script src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/")
555
+ end
556
+
557
+ end
558
+
559
+ describe "with args of {:jQueryUI => false}" do
560
+
561
+ it "has no jQuery UI javascript link tag" do
562
+ jquids_includes(:jQueryUI => false).should_not include("<script src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/")
563
+ end
564
+
565
+ end
566
+
567
+ Jquids::STYLES.each do |style|
568
+
569
+ describe "with args of {:style => #{style[0]}}" do
570
+
571
+ it "has the #{style[0]} stylesheet link tag" do
572
+ jquids_includes(:style => style[0]).should include("<link href=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/#{style[1]}/jquery-ui.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />")
573
+ end
574
+
575
+ end
576
+
577
+ end
578
+
579
+ describe "with args of {:style => :none}" do
580
+
581
+ it "has no stylesheet" do
582
+ jquids_includes(:style => :none).should_not include("<link href=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/")
583
+ end
584
+
585
+ end
586
+
587
+ describe "with args of {:style => nil}" do
588
+
589
+ it "has no stylesheet" do
590
+ jquids_includes(:style => nil).should_not include("<link href=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/")
591
+ end
592
+
593
+ end
594
+
595
+ describe "with args of {:style => false}" do
596
+
597
+ it "has no stylesheet" do
598
+ jquids_includes(:style => false).should_not include("<link href=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/")
599
+ end
600
+
601
+ end
602
+
603
+ Jquids::TimepickerTags.each do |v|
604
+
605
+ describe "with args of {:TRTimepicker => #{v}}" do
606
+
607
+ it "has the #{v} Trent Richardson Timepicker javascript link tag" do
608
+ jquids_includes(:TRTimepicker => v).should include("<script src=\"https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/#{v}/jquery-ui-timepicker-addon.js\" type=\"text/javascript\"></script>")
609
+ end
610
+
611
+ end
612
+
613
+ end
614
+
615
+ describe "with no :TRTimepicker key" do
616
+
617
+ it "doesn't return a Trent Richardson Timepicker javascript link tag" do
618
+ jquids_includes().should_not include("<script src=\"https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/")
619
+ end
620
+
621
+ end
622
+
623
+ describe "with args of {:TRTimepicker => :none}" do
624
+
625
+ it "doesn't return a Trent Richardson Timepicker javascript link tag" do
626
+ jquids_includes(:TRTimepicker => :none).should_not include("<script src=\"https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/")
627
+ end
628
+
629
+ end
630
+
631
+ describe "with args of {:TRTimepicker => false}" do
632
+
633
+ it "doesn't return a Trent Richardson Timepicker javascript link tag" do
634
+ jquids_includes(:TRTimepicker => false).should_not include("<script src=\"https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/")
635
+ end
636
+
637
+ end
638
+
639
+ describe "with args of {:TRTimepicker => nil}" do
640
+
641
+ it "doesn't return a Trent Richardson Timepicker javascript link tag" do
642
+ jquids_includes(:TRTimepicker => nil).should_not include("<script src=\"https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/")
643
+ end
644
+
645
+ end
646
+
647
+ end
648
+
649
+ end