wd_sinatra 1.0.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +1 -4
- data/CHANGELOG.md +20 -0
- data/Gemfile +0 -2
- data/LICENSE +4 -2
- data/README.md +28 -19
- data/bin/wd_sinatra +7 -25
- data/lib/wd_sinatra/app_loader.rb +12 -20
- data/lib/wd_sinatra/sinatra_ext.rb +8 -7
- data/lib/wd_sinatra/test_helpers.rb +1 -1
- data/lib/wd_sinatra/version.rb +2 -4
- data/templates/Gemfile +16 -11
- data/templates/{Rakefile → Rakefile.tt} +4 -4
- data/templates/Thorfile +14 -8
- data/templates/api/hello_world.rb +17 -10
- data/templates/bin/console +1 -1
- data/templates/config.ru.tt +6 -0
- data/templates/config/sinatra_config.rb.tt +50 -0
- data/templates/lib/{app.rb → app.rb.tt} +4 -1
- data/templates/lib/hooks.rb +25 -15
- data/templates/test/{test_helpers.rb → test_helpers.rb.tt} +8 -6
- data/test/test_helper.rb +0 -4
- data/test/ws_list_ext_test.rb +6 -6
- data/wd-sinatra.gemspec +11 -7
- metadata +72 -104
- data/templates/config.ru +0 -5
- data/templates/config/middleware.rb +0 -16
- data/templates/config/sinatra_config.rb +0 -18
- data/templates/lib/body_parser.rb +0 -24
- data/templates/lib/tasks/doc.rake +0 -39
- data/templates/lib/tasks/doc_generator/bootstrap/.gitignore +0 -4
- data/templates/lib/tasks/doc_generator/bootstrap/LICENSE +0 -176
- data/templates/lib/tasks/doc_generator/bootstrap/Makefile +0 -47
- data/templates/lib/tasks/doc_generator/bootstrap/README.md +0 -105
- data/templates/lib/tasks/doc_generator/bootstrap/bootstrap.css +0 -2467
- data/templates/lib/tasks/doc_generator/bootstrap/bootstrap.min.css +0 -356
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/css/docs.css +0 -317
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/bootstrap-apple-114x114.png +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/bootstrap-apple-57x57.png +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/bootstrap-apple-72x72.png +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/favicon.ico +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/bird.png +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/browsers.png +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/example-diagram-01.png +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/example-diagram-02.png +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/example-diagram-03.png +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/grid-18px.png +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/twitter-logo-no-bird.png +0 -0
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/js/application.js +0 -52
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/js/google-code-prettify/prettify.css +0 -94
- data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/js/google-code-prettify/prettify.js +0 -28
- data/templates/lib/tasks/doc_generator/bootstrap/docs/index.html +0 -2037
- data/templates/lib/tasks/doc_generator/bootstrap/docs/javascript.html +0 -798
- data/templates/lib/tasks/doc_generator/bootstrap/examples/container-app.html +0 -119
- data/templates/lib/tasks/doc_generator/bootstrap/examples/fluid.html +0 -122
- data/templates/lib/tasks/doc_generator/bootstrap/examples/hero.html +0 -79
- data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-alerts.js +0 -124
- data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-buttons.js +0 -64
- data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-dropdown.js +0 -55
- data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-modal.js +0 -260
- data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-popover.js +0 -90
- data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-scrollspy.js +0 -107
- data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-tabs.js +0 -80
- data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-twipsy.js +0 -321
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/index.html +0 -40
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-alerts.js +0 -41
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-buttons.js +0 -42
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-dropdown.js +0 -52
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-modal.js +0 -151
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-popover.js +0 -76
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-scrollspy.js +0 -31
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-tabs.js +0 -77
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-twipsy.js +0 -81
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/vendor/qunit.css +0 -232
- data/templates/lib/tasks/doc_generator/bootstrap/js/tests/vendor/qunit.js +0 -1510
- data/templates/lib/tasks/doc_generator/bootstrap/lib/bootstrap.less +0 -26
- data/templates/lib/tasks/doc_generator/bootstrap/lib/forms.less +0 -479
- data/templates/lib/tasks/doc_generator/bootstrap/lib/mixins.less +0 -222
- data/templates/lib/tasks/doc_generator/bootstrap/lib/patterns.less +0 -1060
- data/templates/lib/tasks/doc_generator/bootstrap/lib/reset.less +0 -141
- data/templates/lib/tasks/doc_generator/bootstrap/lib/scaffolding.less +0 -139
- data/templates/lib/tasks/doc_generator/bootstrap/lib/tables.less +0 -224
- data/templates/lib/tasks/doc_generator/bootstrap/lib/type.less +0 -187
- data/templates/lib/tasks/doc_generator/bootstrap/lib/variables.less +0 -60
- data/templates/lib/tasks/doc_generator/template.erb +0 -156
@@ -1,42 +0,0 @@
|
|
1
|
-
$(function () {
|
2
|
-
|
3
|
-
module("bootstrap-buttons")
|
4
|
-
|
5
|
-
test("should be defined on jquery object", function () {
|
6
|
-
ok($(document.body).button, 'tabs method is defined')
|
7
|
-
})
|
8
|
-
|
9
|
-
test("should return element", function () {
|
10
|
-
ok($(document.body).button()[0] == document.body, 'document.body returned')
|
11
|
-
})
|
12
|
-
|
13
|
-
test("should return set state to loading", function () {
|
14
|
-
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
15
|
-
equals(btn.html(), 'mdo', 'btn text equals mdo')
|
16
|
-
btn.button('loading')
|
17
|
-
equals(btn.html(), 'fat', 'btn text equals fat')
|
18
|
-
ok(btn.attr('disabled'), 'btn is disabled')
|
19
|
-
ok(btn.hasClass('disabled'), 'btn has disabled class')
|
20
|
-
})
|
21
|
-
|
22
|
-
test("should return reset state", function () {
|
23
|
-
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
24
|
-
equals(btn.html(), 'mdo', 'btn text equals mdo')
|
25
|
-
btn.button('loading')
|
26
|
-
equals(btn.html(), 'fat', 'btn text equals fat')
|
27
|
-
ok(btn.attr('disabled'), 'btn is disabled')
|
28
|
-
ok(btn.hasClass('disabled'), 'btn is disabled')
|
29
|
-
btn.button('reset')
|
30
|
-
equals(btn.html(), 'mdo', 'btn text equals mdo')
|
31
|
-
ok(!btn.attr('disabled'), 'btn is not disabled')
|
32
|
-
ok(!btn.hasClass('disabled'), 'btn does not have disabled class')
|
33
|
-
})
|
34
|
-
|
35
|
-
test("should toggle active", function () {
|
36
|
-
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
37
|
-
ok(!btn.hasClass('active'), 'btn does not have active class')
|
38
|
-
btn.button('toggle')
|
39
|
-
ok(btn.hasClass('active'), 'btn has class active')
|
40
|
-
})
|
41
|
-
|
42
|
-
})
|
@@ -1,52 +0,0 @@
|
|
1
|
-
$(function () {
|
2
|
-
|
3
|
-
module("bootstrap-dropdowns")
|
4
|
-
|
5
|
-
test("should be defined on jquery object", function () {
|
6
|
-
ok($(document.body).dropdown, 'dropdown method is defined')
|
7
|
-
})
|
8
|
-
|
9
|
-
test("should return element", function () {
|
10
|
-
ok($(document.body).dropdown()[0] == document.body, 'document.body returned')
|
11
|
-
})
|
12
|
-
|
13
|
-
test("should add class open to menu if clicked", function () {
|
14
|
-
var dropdownHTML = '<ul class="tabs">'
|
15
|
-
+ '<li class="dropdown">'
|
16
|
-
+ '<a href="#" class="dropdown-toggle">Dropdown</a>'
|
17
|
-
+ '<ul class="dropdown-menu">'
|
18
|
-
+ '<li><a href="#">Secondary link</a></li>'
|
19
|
-
+ '<li><a href="#">Something else here</a></li>'
|
20
|
-
+ '<li class="divider"></li>'
|
21
|
-
+ '<li><a href="#">Another link</a></li>'
|
22
|
-
+ '</ul>'
|
23
|
-
+ '</li>'
|
24
|
-
+ '</ul>'
|
25
|
-
, dropdown = $(dropdownHTML).dropdown()
|
26
|
-
|
27
|
-
dropdown.find('.dropdown-toggle').click()
|
28
|
-
ok(dropdown.find('.dropdown').hasClass('open'), 'open class added on click')
|
29
|
-
})
|
30
|
-
|
31
|
-
test("should remove open class if body clicked", function () {
|
32
|
-
var dropdownHTML = '<ul class="tabs">'
|
33
|
-
+ '<li class="dropdown">'
|
34
|
-
+ '<a href="#" class="dropdown-toggle">Dropdown</a>'
|
35
|
-
+ '<ul class="dropdown-menu">'
|
36
|
-
+ '<li><a href="#">Secondary link</a></li>'
|
37
|
-
+ '<li><a href="#">Something else here</a></li>'
|
38
|
-
+ '<li class="divider"></li>'
|
39
|
-
+ '<li><a href="#">Another link</a></li>'
|
40
|
-
+ '</ul>'
|
41
|
-
+ '</li>'
|
42
|
-
+ '</ul>'
|
43
|
-
, dropdown = $(dropdownHTML).dropdown().appendTo('#qunit-runoff')
|
44
|
-
|
45
|
-
dropdown.find('.dropdown-toggle').click()
|
46
|
-
ok(dropdown.find('.dropdown').hasClass('open'), 'open class added on click')
|
47
|
-
$('body').click()
|
48
|
-
ok(!dropdown.find('.dropdown').hasClass('open'), 'open class removed')
|
49
|
-
dropdown.remove()
|
50
|
-
})
|
51
|
-
|
52
|
-
})
|
@@ -1,151 +0,0 @@
|
|
1
|
-
$(function () {
|
2
|
-
|
3
|
-
module("bootstrap-modal")
|
4
|
-
|
5
|
-
test("should be defined on jquery object", function () {
|
6
|
-
var div = $("<div id='modal-test'></div>")
|
7
|
-
ok(div.modal, 'modal method is defined')
|
8
|
-
})
|
9
|
-
|
10
|
-
test("should return element", function () {
|
11
|
-
var div = $("<div id='modal-test'></div>")
|
12
|
-
ok(div.modal() == div, 'div element returned')
|
13
|
-
})
|
14
|
-
|
15
|
-
test("should expose defaults var for settings", function () {
|
16
|
-
ok($.fn.modal.defaults, 'default object exposed')
|
17
|
-
})
|
18
|
-
|
19
|
-
test("should insert into dom when show method is called", function () {
|
20
|
-
stop()
|
21
|
-
$.support.transition = false
|
22
|
-
var div = $("<div id='modal-test'></div>")
|
23
|
-
div
|
24
|
-
.modal()
|
25
|
-
.bind("shown", function () {
|
26
|
-
ok($('#modal-test').length, 'modal insterted into dom')
|
27
|
-
start()
|
28
|
-
div.remove()
|
29
|
-
})
|
30
|
-
.modal("show")
|
31
|
-
})
|
32
|
-
|
33
|
-
test("should hide modal when hide is called", function () {
|
34
|
-
stop()
|
35
|
-
$.support.transition = false
|
36
|
-
var div = $("<div id='modal-test'></div>")
|
37
|
-
div
|
38
|
-
.modal()
|
39
|
-
.bind("shown", function () {
|
40
|
-
ok($('#modal-test').is(":visible"), 'modal visible')
|
41
|
-
ok($('#modal-test').length, 'modal insterted into dom')
|
42
|
-
div.modal("hide")
|
43
|
-
})
|
44
|
-
.bind("hidden", function() {
|
45
|
-
ok(!$('#modal-test').is(":visible"), 'modal hidden')
|
46
|
-
start()
|
47
|
-
div.remove()
|
48
|
-
})
|
49
|
-
.modal("show")
|
50
|
-
})
|
51
|
-
|
52
|
-
test("should toggle when toggle is called", function () {
|
53
|
-
stop()
|
54
|
-
$.support.transition = false
|
55
|
-
var div = $("<div id='modal-test'></div>")
|
56
|
-
div
|
57
|
-
.modal()
|
58
|
-
.bind("shown", function () {
|
59
|
-
ok($('#modal-test').is(":visible"), 'modal visible')
|
60
|
-
ok($('#modal-test').length, 'modal insterted into dom')
|
61
|
-
div.modal("toggle")
|
62
|
-
})
|
63
|
-
.bind("hidden", function() {
|
64
|
-
ok(!$('#modal-test').is(":visible"), 'modal hidden')
|
65
|
-
start()
|
66
|
-
div.remove()
|
67
|
-
})
|
68
|
-
.modal("toggle")
|
69
|
-
})
|
70
|
-
|
71
|
-
test("should remove from dom when click .close", function () {
|
72
|
-
stop()
|
73
|
-
$.support.transition = false
|
74
|
-
var div = $("<div id='modal-test'><span class='close'></span></div>")
|
75
|
-
div
|
76
|
-
.modal()
|
77
|
-
.bind("shown", function () {
|
78
|
-
ok($('#modal-test').is(":visible"), 'modal visible')
|
79
|
-
ok($('#modal-test').length, 'modal insterted into dom')
|
80
|
-
div.find('.close').click()
|
81
|
-
})
|
82
|
-
.bind("hidden", function() {
|
83
|
-
ok(!$('#modal-test').is(":visible"), 'modal hidden')
|
84
|
-
start()
|
85
|
-
div.remove()
|
86
|
-
})
|
87
|
-
.modal("toggle")
|
88
|
-
})
|
89
|
-
|
90
|
-
test("should add backdrop when desired", function () {
|
91
|
-
stop()
|
92
|
-
$.support.transition = false
|
93
|
-
var div = $("<div id='modal-test'></div>")
|
94
|
-
div
|
95
|
-
.modal({ backdrop:true })
|
96
|
-
.bind("shown", function () {
|
97
|
-
equal($('.modal-backdrop').length, 1, 'modal backdrop inserted into dom')
|
98
|
-
start()
|
99
|
-
div.remove()
|
100
|
-
$('.modal-backdrop').remove()
|
101
|
-
})
|
102
|
-
.modal("show")
|
103
|
-
})
|
104
|
-
|
105
|
-
test("should not add backdrop when not desired", function () {
|
106
|
-
stop()
|
107
|
-
$.support.transition = false
|
108
|
-
var div = $("<div id='modal-test'></div>")
|
109
|
-
div
|
110
|
-
.modal({backdrop:false})
|
111
|
-
.bind("shown", function () {
|
112
|
-
equal($('.modal-backdrop').length, 0, 'modal backdrop not inserted into dom')
|
113
|
-
start()
|
114
|
-
div.remove()
|
115
|
-
})
|
116
|
-
.modal("show")
|
117
|
-
})
|
118
|
-
|
119
|
-
test("should close backdrop when clicked", function () {
|
120
|
-
stop()
|
121
|
-
$.support.transition = false
|
122
|
-
var div = $("<div id='modal-test'></div>")
|
123
|
-
div
|
124
|
-
.modal({backdrop:true})
|
125
|
-
.bind("shown", function () {
|
126
|
-
equal($('.modal-backdrop').length, 1, 'modal backdrop inserted into dom')
|
127
|
-
$('.modal-backdrop').click()
|
128
|
-
equal($('.modal-backdrop').length, 0, 'modal backdrop removed from dom')
|
129
|
-
start()
|
130
|
-
div.remove()
|
131
|
-
})
|
132
|
-
.modal("show")
|
133
|
-
})
|
134
|
-
|
135
|
-
test("should not close backdrop when click disabled", function () {
|
136
|
-
stop()
|
137
|
-
$.support.transition = false
|
138
|
-
var div = $("<div id='modal-test'></div>")
|
139
|
-
div
|
140
|
-
.modal({backdrop: 'static'})
|
141
|
-
.bind("shown", function () {
|
142
|
-
equal($('.modal-backdrop').length, 1, 'modal backdrop inserted into dom')
|
143
|
-
$('.modal-backdrop').click()
|
144
|
-
equal($('.modal-backdrop').length, 1, 'modal backdrop still in dom')
|
145
|
-
start()
|
146
|
-
div.remove()
|
147
|
-
$('.modal-backdrop').remove()
|
148
|
-
})
|
149
|
-
.modal("show")
|
150
|
-
})
|
151
|
-
})
|
@@ -1,76 +0,0 @@
|
|
1
|
-
$(function () {
|
2
|
-
|
3
|
-
module("bootstrap-popover")
|
4
|
-
|
5
|
-
test("should be defined on jquery object", function () {
|
6
|
-
var div = $('<div></div>')
|
7
|
-
ok(div.popover, 'popover method is defined')
|
8
|
-
})
|
9
|
-
|
10
|
-
test("should return element", function () {
|
11
|
-
var div = $('<div></div>')
|
12
|
-
ok(div.popover() == div, 'document.body returned')
|
13
|
-
})
|
14
|
-
|
15
|
-
test("should render popover element", function () {
|
16
|
-
$.support.transition = false
|
17
|
-
var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>')
|
18
|
-
.appendTo('#qunit-runoff')
|
19
|
-
.popover()
|
20
|
-
.popover('show')
|
21
|
-
|
22
|
-
ok($('.popover').length, 'popover was inserted')
|
23
|
-
popover.popover('hide')
|
24
|
-
ok(!$(".popover").length, 'popover removed')
|
25
|
-
$('#qunit-runoff').empty()
|
26
|
-
})
|
27
|
-
|
28
|
-
test("should store popover instance in popover data object", function () {
|
29
|
-
$.support.transition = false
|
30
|
-
var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>')
|
31
|
-
.popover()
|
32
|
-
|
33
|
-
ok(!!popover.data('popover'), 'popover instance exists')
|
34
|
-
})
|
35
|
-
|
36
|
-
test("should get title and content from options", function () {
|
37
|
-
$.support.transition = false
|
38
|
-
var popover = $('<a href="#">@fat</a>')
|
39
|
-
.appendTo('#qunit-runoff')
|
40
|
-
.popover({
|
41
|
-
title: function () {
|
42
|
-
return '@fat'
|
43
|
-
}
|
44
|
-
, content: function () {
|
45
|
-
return 'loves writing tests (╯°□°)╯︵ ┻━┻'
|
46
|
-
}
|
47
|
-
})
|
48
|
-
|
49
|
-
popover.popover('show')
|
50
|
-
|
51
|
-
ok($('.popover').length, 'popover was inserted')
|
52
|
-
equals($('.popover .title').text(), '@fat', 'title correctly inserted')
|
53
|
-
equals($('.popover .content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
|
54
|
-
|
55
|
-
popover.popover('hide')
|
56
|
-
ok(!$('.popover').length, 'popover was removed')
|
57
|
-
$('#qunit-runoff').empty()
|
58
|
-
})
|
59
|
-
|
60
|
-
test("should get title and content from attributes", function () {
|
61
|
-
$.support.transition = false
|
62
|
-
var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
63
|
-
.appendTo('#qunit-runoff')
|
64
|
-
.popover()
|
65
|
-
.popover('show')
|
66
|
-
|
67
|
-
ok($('.popover').length, 'popover was inserted')
|
68
|
-
equals($('.popover .title').text(), '@mdo', 'title correctly inserted')
|
69
|
-
equals($('.popover .content').text(), "loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻", 'content correctly inserted')
|
70
|
-
|
71
|
-
popover.popover('hide')
|
72
|
-
ok(!$('.popover').length, 'popover was removed')
|
73
|
-
$('#qunit-runoff').empty()
|
74
|
-
})
|
75
|
-
|
76
|
-
})
|
@@ -1,31 +0,0 @@
|
|
1
|
-
$(function () {
|
2
|
-
|
3
|
-
module("bootstrap-scrollspy")
|
4
|
-
|
5
|
-
test("should be defined on jquery object", function () {
|
6
|
-
ok($(document.body).scrollspy, 'scrollspy method is defined')
|
7
|
-
})
|
8
|
-
|
9
|
-
test("should return element", function () {
|
10
|
-
ok($(document.body).scrollspy()[0] == document.body, 'document.body returned')
|
11
|
-
})
|
12
|
-
|
13
|
-
test("should switch active class on scroll", function () {
|
14
|
-
var sectionHTML = '<div id="masthead"></div>'
|
15
|
-
, $section = $(sectionHTML).append('#qunit-runoff')
|
16
|
-
, topbarHTML ='<div class="topbar">'
|
17
|
-
+ '<div class="topbar-inner">'
|
18
|
-
+ '<div class="container">'
|
19
|
-
+ '<h3><a href="#">Bootstrap</a></h3>'
|
20
|
-
+ '<ul class="nav">'
|
21
|
-
+ '<li><a href="#masthead">Overview</a></li>'
|
22
|
-
+ '</ul>'
|
23
|
-
+ '</div>'
|
24
|
-
+ '</div>'
|
25
|
-
+ '</div>'
|
26
|
-
, $topbar = $(topbarHTML).topbar()
|
27
|
-
|
28
|
-
ok(topbar.find('.active', true)
|
29
|
-
})
|
30
|
-
|
31
|
-
})
|
@@ -1,77 +0,0 @@
|
|
1
|
-
$(function () {
|
2
|
-
|
3
|
-
module("bootstrap-tabs")
|
4
|
-
|
5
|
-
test("should be defined on jquery object", function () {
|
6
|
-
ok($(document.body).tabs, 'tabs method is defined')
|
7
|
-
})
|
8
|
-
|
9
|
-
test("should return element", function () {
|
10
|
-
ok($(document.body).tabs()[0] == document.body, 'document.body returned')
|
11
|
-
})
|
12
|
-
|
13
|
-
test("should activate element by tab id", function () {
|
14
|
-
var $tabsHTML = $('<ul class="tabs">'
|
15
|
-
+ '<li class="active"><a href="#home">Home</a></li>'
|
16
|
-
+ '<li><a href="#profile">Profile</a></li>'
|
17
|
-
+ '</ul>')
|
18
|
-
|
19
|
-
|
20
|
-
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-runoff")
|
21
|
-
|
22
|
-
$tabsHTML.tabs().find('a').last().click()
|
23
|
-
equals($("#qunit-runoff").find('.active').attr('id'), "profile")
|
24
|
-
|
25
|
-
$tabsHTML.tabs().find('a').first().click()
|
26
|
-
equals($("#qunit-runoff").find('.active').attr('id'), "home")
|
27
|
-
|
28
|
-
$("#qunit-runoff").empty()
|
29
|
-
})
|
30
|
-
|
31
|
-
test("should activate element by pill id", function () {
|
32
|
-
var $pillsHTML = $('<ul class="pills">'
|
33
|
-
+ '<li class="active"><a href="#home">Home</a></li>'
|
34
|
-
+ '<li><a href="#profile">Profile</a></li>'
|
35
|
-
+ '</ul>')
|
36
|
-
|
37
|
-
|
38
|
-
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-runoff")
|
39
|
-
|
40
|
-
$pillsHTML.pills().find('a').last().click()
|
41
|
-
equals($("#qunit-runoff").find('.active').attr('id'), "profile")
|
42
|
-
|
43
|
-
$pillsHTML.pills().find('a').first().click()
|
44
|
-
equals($("#qunit-runoff").find('.active').attr('id'), "home")
|
45
|
-
|
46
|
-
$("#qunit-runoff").empty()
|
47
|
-
})
|
48
|
-
|
49
|
-
test( "should trigger change event on activate", function () {
|
50
|
-
var $tabsHTML = $('<ul class="tabs">'
|
51
|
-
+ '<li class="active"><a href="#home">Home</a></li>'
|
52
|
-
+ '<li><a href="#profile">Profile</a></li>'
|
53
|
-
+ '</ul>')
|
54
|
-
, $target
|
55
|
-
, count = 0
|
56
|
-
, relatedTarget
|
57
|
-
, target
|
58
|
-
|
59
|
-
$tabsHTML
|
60
|
-
.tabs()
|
61
|
-
.bind( "change", function (e) {
|
62
|
-
target = e.target
|
63
|
-
relatedTarget = e.relatedTarget
|
64
|
-
count++
|
65
|
-
})
|
66
|
-
|
67
|
-
$target = $tabsHTML
|
68
|
-
.find('a')
|
69
|
-
.last()
|
70
|
-
.click()
|
71
|
-
|
72
|
-
equals(relatedTarget, $tabsHTML.find('a').first()[0])
|
73
|
-
equals(target, $target[0])
|
74
|
-
equals(count, 1)
|
75
|
-
})
|
76
|
-
|
77
|
-
})
|
@@ -1,81 +0,0 @@
|
|
1
|
-
$(function () {
|
2
|
-
|
3
|
-
module("bootstrap-twipsy")
|
4
|
-
|
5
|
-
test("should be defined on jquery object", function () {
|
6
|
-
var div = $("<div></div>")
|
7
|
-
ok(div.twipsy, 'popover method is defined')
|
8
|
-
})
|
9
|
-
|
10
|
-
test("should return element", function () {
|
11
|
-
var div = $("<div></div>")
|
12
|
-
ok(div.twipsy() == div, 'document.body returned')
|
13
|
-
})
|
14
|
-
|
15
|
-
test("should expose default settings", function () {
|
16
|
-
ok(!!$.fn.twipsy.defaults, 'defaults is defined')
|
17
|
-
})
|
18
|
-
|
19
|
-
test("should remove title attribute", function () {
|
20
|
-
var twipsy = $('<a href="#" rel="twipsy" title="Another twipsy"></a>').twipsy()
|
21
|
-
ok(!twipsy.attr('title'), 'title tag was removed')
|
22
|
-
})
|
23
|
-
|
24
|
-
test("should add data attribute for referencing original title", function () {
|
25
|
-
var twipsy = $('<a href="#" rel="twipsy" title="Another twipsy"></a>').twipsy()
|
26
|
-
equals(twipsy.attr('data-original-title'), 'Another twipsy', 'original title preserved in data attribute')
|
27
|
-
})
|
28
|
-
|
29
|
-
test("should place tooltips relative to placement option", function () {
|
30
|
-
$.support.transition = false
|
31
|
-
var twipsy = $('<a href="#" rel="twipsy" title="Another twipsy"></a>')
|
32
|
-
.appendTo('#qunit-runoff')
|
33
|
-
.twipsy({placement: 'below'})
|
34
|
-
.twipsy('show')
|
35
|
-
|
36
|
-
ok($(".twipsy").hasClass('fade below in'), 'has correct classes applied')
|
37
|
-
twipsy.twipsy('hide')
|
38
|
-
ok(!$(".twipsy").length, 'twipsy removed')
|
39
|
-
$('#qunit-runoff').empty()
|
40
|
-
})
|
41
|
-
|
42
|
-
test("should add a fallback in cases where elements have no title tag", function () {
|
43
|
-
$.support.transition = false
|
44
|
-
var twipsy = $('<a href="#" rel="twipsy"></a>')
|
45
|
-
.appendTo('#qunit-runoff')
|
46
|
-
.twipsy({fallback: '@fat'})
|
47
|
-
.twipsy('show')
|
48
|
-
|
49
|
-
equals($(".twipsy").text(), "@fat", 'has correct default text')
|
50
|
-
twipsy.twipsy('hide')
|
51
|
-
ok(!$(".twipsy").length, 'twipsy removed')
|
52
|
-
$('#qunit-runoff').empty()
|
53
|
-
})
|
54
|
-
|
55
|
-
test("should not allow html entities", function () {
|
56
|
-
$.support.transition = false
|
57
|
-
var twipsy = $('<a href="#" rel="twipsy" title="<b>@fat</b>"></a>')
|
58
|
-
.appendTo('#qunit-runoff')
|
59
|
-
.twipsy()
|
60
|
-
.twipsy('show')
|
61
|
-
|
62
|
-
ok(!$('.twipsy b').length, 'b tag was not inserted')
|
63
|
-
twipsy.twipsy('hide')
|
64
|
-
ok(!$(".twipsy").length, 'twipsy removed')
|
65
|
-
$('#qunit-runoff').empty()
|
66
|
-
})
|
67
|
-
|
68
|
-
test("should allow html entities if html option set to true", function () {
|
69
|
-
$.support.transition = false
|
70
|
-
var twipsy = $('<a href="#" rel="twipsy" title="<b>@fat</b>"></a>')
|
71
|
-
.appendTo('#qunit-runoff')
|
72
|
-
.twipsy({html: true})
|
73
|
-
.twipsy('show')
|
74
|
-
|
75
|
-
ok($('.twipsy b').length, 'b tag was inserted')
|
76
|
-
twipsy.twipsy('hide')
|
77
|
-
ok(!$(".twipsy").length, 'twipsy removed')
|
78
|
-
$('#qunit-runoff').empty()
|
79
|
-
})
|
80
|
-
|
81
|
-
})
|