twigg-app 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +7 -0
  2. data/data/quips.yml +45 -0
  3. data/lib/twigg-app/app/quips.rb +13 -0
  4. data/lib/twigg-app/app/routes.rb +43 -0
  5. data/lib/twigg-app/app/server.rb +146 -0
  6. data/lib/twigg-app/app/version.rb +5 -0
  7. data/lib/twigg-app/app.rb +14 -0
  8. data/lib/twigg-app.rb +5 -0
  9. data/public/application.js +106 -0
  10. data/public/favicon.ico +0 -0
  11. data/public/favicon.png +0 -0
  12. data/public/vendor/bootstrap/CNAME +1 -0
  13. data/public/vendor/bootstrap/CONTRIBUTING.md +66 -0
  14. data/public/vendor/bootstrap/Gruntfile.js +195 -0
  15. data/public/vendor/bootstrap/LICENSE +176 -0
  16. data/public/vendor/bootstrap/README.md +139 -0
  17. data/public/vendor/bootstrap/_config.yml +28 -0
  18. data/public/vendor/bootstrap/_includes/ads.html +1 -0
  19. data/public/vendor/bootstrap/_includes/footer.html +33 -0
  20. data/public/vendor/bootstrap/_includes/header.html +43 -0
  21. data/public/vendor/bootstrap/_includes/nav-components.html +135 -0
  22. data/public/vendor/bootstrap/_includes/nav-css.html +77 -0
  23. data/public/vendor/bootstrap/_includes/nav-customize.html +40 -0
  24. data/public/vendor/bootstrap/_includes/nav-getting-started.html +28 -0
  25. data/public/vendor/bootstrap/_includes/nav-javascript.html +88 -0
  26. data/public/vendor/bootstrap/_includes/nav-main.html +32 -0
  27. data/public/vendor/bootstrap/_includes/old-bs-docs.html +8 -0
  28. data/public/vendor/bootstrap/_includes/social-buttons.html +16 -0
  29. data/public/vendor/bootstrap/_layouts/customize.html +52 -0
  30. data/public/vendor/bootstrap/_layouts/default.html +72 -0
  31. data/public/vendor/bootstrap/_layouts/home.html +43 -0
  32. data/public/vendor/bootstrap/assets/css/docs.css +896 -0
  33. data/public/vendor/bootstrap/assets/css/pygments-manni.css +66 -0
  34. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
  35. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
  36. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
  37. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
  38. data/public/vendor/bootstrap/assets/ico/favicon.png +0 -0
  39. data/public/vendor/bootstrap/assets/js/application.js +82 -0
  40. data/public/vendor/bootstrap/assets/js/customizer.js +175 -0
  41. data/public/vendor/bootstrap/assets/js/holder.js +419 -0
  42. data/public/vendor/bootstrap/assets/js/html5shiv.js +8 -0
  43. data/public/vendor/bootstrap/assets/js/jquery.bbq.min.js +1287 -0
  44. data/public/vendor/bootstrap/assets/js/jquery.js +5 -0
  45. data/public/vendor/bootstrap/assets/js/jszip.js +1425 -0
  46. data/public/vendor/bootstrap/assets/js/less.js +9 -0
  47. data/public/vendor/bootstrap/assets/js/respond.min.js +6 -0
  48. data/public/vendor/bootstrap/assets/js/uglify.js +14 -0
  49. data/public/vendor/bootstrap/bower.json +11 -0
  50. data/public/vendor/bootstrap/browserstack.json +37 -0
  51. data/public/vendor/bootstrap/components.html +2555 -0
  52. data/public/vendor/bootstrap/composer.json +20 -0
  53. data/public/vendor/bootstrap/css.html +2276 -0
  54. data/public/vendor/bootstrap/customize.html +1480 -0
  55. data/public/vendor/bootstrap/dist/css/bootstrap.css +5579 -0
  56. data/public/vendor/bootstrap/dist/css/bootstrap.min.css +9 -0
  57. data/public/vendor/bootstrap/dist/js/bootstrap.js +1993 -0
  58. data/public/vendor/bootstrap/dist/js/bootstrap.min.js +6 -0
  59. data/public/vendor/bootstrap/getting-started.html +375 -0
  60. data/public/vendor/bootstrap/index.html +16 -0
  61. data/public/vendor/bootstrap/javascript.html +1904 -0
  62. data/public/vendor/bootstrap/js/affix.js +126 -0
  63. data/public/vendor/bootstrap/js/alert.js +98 -0
  64. data/public/vendor/bootstrap/js/button.js +109 -0
  65. data/public/vendor/bootstrap/js/carousel.js +217 -0
  66. data/public/vendor/bootstrap/js/collapse.js +179 -0
  67. data/public/vendor/bootstrap/js/dropdown.js +154 -0
  68. data/public/vendor/bootstrap/js/modal.js +244 -0
  69. data/public/vendor/bootstrap/js/popover.js +117 -0
  70. data/public/vendor/bootstrap/js/scrollspy.js +158 -0
  71. data/public/vendor/bootstrap/js/tab.js +135 -0
  72. data/public/vendor/bootstrap/js/tests/index.html +52 -0
  73. data/public/vendor/bootstrap/js/tests/phantom.js +63 -0
  74. data/public/vendor/bootstrap/js/tests/server.js +14 -0
  75. data/public/vendor/bootstrap/js/tests/unit/affix.js +25 -0
  76. data/public/vendor/bootstrap/js/tests/unit/alert.js +62 -0
  77. data/public/vendor/bootstrap/js/tests/unit/button.js +116 -0
  78. data/public/vendor/bootstrap/js/tests/unit/carousel.js +87 -0
  79. data/public/vendor/bootstrap/js/tests/unit/collapse.js +164 -0
  80. data/public/vendor/bootstrap/js/tests/unit/dropdown.js +219 -0
  81. data/public/vendor/bootstrap/js/tests/unit/modal.js +177 -0
  82. data/public/vendor/bootstrap/js/tests/unit/phantom.js +69 -0
  83. data/public/vendor/bootstrap/js/tests/unit/popover.js +133 -0
  84. data/public/vendor/bootstrap/js/tests/unit/scrollspy.js +37 -0
  85. data/public/vendor/bootstrap/js/tests/unit/tab.js +86 -0
  86. data/public/vendor/bootstrap/js/tests/unit/tooltip.js +437 -0
  87. data/public/vendor/bootstrap/js/tests/unit/transition.js +13 -0
  88. data/public/vendor/bootstrap/js/tests/vendor/jquery.js +5 -0
  89. data/public/vendor/bootstrap/js/tests/vendor/qunit.css +232 -0
  90. data/public/vendor/bootstrap/js/tests/vendor/qunit.js +1510 -0
  91. data/public/vendor/bootstrap/js/tooltip.js +382 -0
  92. data/public/vendor/bootstrap/js/transition.js +56 -0
  93. data/public/vendor/bootstrap/less/alerts.less +71 -0
  94. data/public/vendor/bootstrap/less/badges.less +51 -0
  95. data/public/vendor/bootstrap/less/bootstrap.less +63 -0
  96. data/public/vendor/bootstrap/less/breadcrumbs.less +23 -0
  97. data/public/vendor/bootstrap/less/button-groups.less +244 -0
  98. data/public/vendor/bootstrap/less/buttons.less +159 -0
  99. data/public/vendor/bootstrap/less/carousel.less +204 -0
  100. data/public/vendor/bootstrap/less/close.less +33 -0
  101. data/public/vendor/bootstrap/less/code.less +56 -0
  102. data/public/vendor/bootstrap/less/component-animations.less +29 -0
  103. data/public/vendor/bootstrap/less/dropdowns.less +176 -0
  104. data/public/vendor/bootstrap/less/forms.less +332 -0
  105. data/public/vendor/bootstrap/less/grid.less +340 -0
  106. data/public/vendor/bootstrap/less/input-groups.less +127 -0
  107. data/public/vendor/bootstrap/less/jumbotron.less +29 -0
  108. data/public/vendor/bootstrap/less/labels.less +54 -0
  109. data/public/vendor/bootstrap/less/list-group.less +88 -0
  110. data/public/vendor/bootstrap/less/media.less +56 -0
  111. data/public/vendor/bootstrap/less/mixins.less +693 -0
  112. data/public/vendor/bootstrap/less/modals.less +133 -0
  113. data/public/vendor/bootstrap/less/navbar.less +559 -0
  114. data/public/vendor/bootstrap/less/navs.less +228 -0
  115. data/public/vendor/bootstrap/less/normalize.less +396 -0
  116. data/public/vendor/bootstrap/less/pager.less +55 -0
  117. data/public/vendor/bootstrap/less/pagination.less +72 -0
  118. data/public/vendor/bootstrap/less/panels.less +128 -0
  119. data/public/vendor/bootstrap/less/popovers.less +133 -0
  120. data/public/vendor/bootstrap/less/print.less +100 -0
  121. data/public/vendor/bootstrap/less/progress-bars.less +99 -0
  122. data/public/vendor/bootstrap/less/responsive-utilities.less +149 -0
  123. data/public/vendor/bootstrap/less/scaffolding.less +111 -0
  124. data/public/vendor/bootstrap/less/tables.less +211 -0
  125. data/public/vendor/bootstrap/less/thumbnails.less +42 -0
  126. data/public/vendor/bootstrap/less/tooltip.less +95 -0
  127. data/public/vendor/bootstrap/less/type.less +238 -0
  128. data/public/vendor/bootstrap/less/utilities.less +42 -0
  129. data/public/vendor/bootstrap/less/variables.less +607 -0
  130. data/public/vendor/bootstrap/less/wells.less +29 -0
  131. data/public/vendor/bootstrap/package.json +33 -0
  132. data/public/vendor/bootstrap-glyphicons/CHANGELOG.md +3 -0
  133. data/public/vendor/bootstrap-glyphicons/CNAME +1 -0
  134. data/public/vendor/bootstrap-glyphicons/CONTRIBUTING.md +54 -0
  135. data/public/vendor/bootstrap-glyphicons/LICENSE +19 -0
  136. data/public/vendor/bootstrap-glyphicons/README.md +61 -0
  137. data/public/vendor/bootstrap-glyphicons/_config.yml +12 -0
  138. data/public/vendor/bootstrap-glyphicons/composer.json +9 -0
  139. data/public/vendor/bootstrap-glyphicons/css/bootstrap-glyphicons.css +2 -0
  140. data/public/vendor/bootstrap-glyphicons/css/bootstrap.css +9 -0
  141. data/public/vendor/bootstrap-glyphicons/css/docs.css +160 -0
  142. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.eot +0 -0
  143. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.otf +0 -0
  144. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.svg +175 -0
  145. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.ttf +0 -0
  146. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.woff +0 -0
  147. data/public/vendor/bootstrap-glyphicons/index.html +255 -0
  148. data/public/vendor/bootstrap-glyphicons/less/bootstrap-glyphicons.less +201 -0
  149. data/public/vendor/bootstrap-glyphicons/package.json +18 -0
  150. data/public/vendor/d3/LICENSE +26 -0
  151. data/public/vendor/d3/README.md +7 -0
  152. data/public/vendor/d3/bower.json +25 -0
  153. data/public/vendor/d3/d3.js +8810 -0
  154. data/public/vendor/d3/d3.min.js +5 -0
  155. data/public/vendor/jquery/README.md +11 -0
  156. data/public/vendor/jquery/bower.json +11 -0
  157. data/public/vendor/jquery/component.json +15 -0
  158. data/public/vendor/jquery/composer.json +35 -0
  159. data/public/vendor/jquery/jquery-migrate.js +511 -0
  160. data/public/vendor/jquery/jquery-migrate.min.js +3 -0
  161. data/public/vendor/jquery/jquery.js +8829 -0
  162. data/public/vendor/jquery/jquery.min.js +6 -0
  163. data/public/vendor/jquery/jquery.min.map +1 -0
  164. data/public/vendor/jquery/package.json +7 -0
  165. data/public/vendor/replacejs/CHANGELOG.md +3 -0
  166. data/public/vendor/replacejs/MIT-LICENSE.txt +20 -0
  167. data/public/vendor/replacejs/README.md +123 -0
  168. data/public/vendor/replacejs/bower.json +24 -0
  169. data/public/vendor/replacejs/primer.js +17 -0
  170. data/public/vendor/replacejs/primer.min.js +1 -0
  171. data/public/vendor/replacejs/replace.js +182 -0
  172. data/public/vendor/stupidtable.js +158 -0
  173. data/views/dashboard.haml +17 -0
  174. data/views/layout.haml +60 -0
  175. metadata +330 -0
@@ -0,0 +1,437 @@
1
+ $(function () {
2
+
3
+ module("tooltip")
4
+
5
+ test("should provide no conflict", function () {
6
+ var tooltip = $.fn.tooltip.noConflict()
7
+ ok(!$.fn.tooltip, 'tooltip was set back to undefined (org value)')
8
+ $.fn.tooltip = tooltip
9
+ })
10
+
11
+ test("should be defined on jquery object", function () {
12
+ var div = $("<div></div>")
13
+ ok(div.tooltip, 'popover method is defined')
14
+ })
15
+
16
+ test("should return element", function () {
17
+ var div = $("<div></div>")
18
+ ok(div.tooltip() == div, 'document.body returned')
19
+ })
20
+
21
+ test("should expose default settings", function () {
22
+ ok(!!$.fn.tooltip.Constructor.DEFAULTS, 'defaults is defined')
23
+ })
24
+
25
+ test("should empty title attribute", function () {
26
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>').tooltip()
27
+ ok(tooltip.attr('title') === '', 'title attribute was emptied')
28
+ })
29
+
30
+ test("should add data attribute for referencing original title", function () {
31
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>').tooltip()
32
+ equals(tooltip.attr('data-original-title'), 'Another tooltip', 'original title preserved in data attribute')
33
+ })
34
+
35
+ test("should place tooltips relative to placement option", function () {
36
+ $.support.transition = false
37
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
38
+ .appendTo('#qunit-fixture')
39
+ .tooltip({placement: 'bottom'})
40
+ .tooltip('show')
41
+
42
+ ok($(".tooltip").is('.fade.bottom.in'), 'has correct classes applied')
43
+ tooltip.tooltip('hide')
44
+ })
45
+
46
+ test("should allow html entities", function () {
47
+ $.support.transition = false
48
+ var tooltip = $('<a href="#" rel="tooltip" title="<b>@fat</b>"></a>')
49
+ .appendTo('#qunit-fixture')
50
+ .tooltip({html: true})
51
+ .tooltip('show')
52
+
53
+ ok($('.tooltip b').length, 'b tag was inserted')
54
+ tooltip.tooltip('hide')
55
+ ok(!$(".tooltip").length, 'tooltip removed')
56
+ })
57
+
58
+ test("should respect custom classes", function () {
59
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
60
+ .appendTo('#qunit-fixture')
61
+ .tooltip({ template: '<div class="tooltip some-class"><div class="tooltip-arrow"/><div class="tooltip-inner"/></div>'})
62
+ .tooltip('show')
63
+
64
+ ok($('.tooltip').hasClass('some-class'), 'custom class is present')
65
+ tooltip.tooltip('hide')
66
+ ok(!$(".tooltip").length, 'tooltip removed')
67
+ })
68
+
69
+ test("should fire show event", function () {
70
+ stop()
71
+ var tooltip = $('<div title="tooltip title"></div>')
72
+ .on("show.bs.tooltip", function() {
73
+ ok(true, "show was called")
74
+ start()
75
+ })
76
+ .tooltip('show')
77
+ })
78
+
79
+ test("should fire shown event", function () {
80
+ stop()
81
+ var tooltip = $('<div title="tooltip title"></div>')
82
+ .on("shown.bs.tooltip", function() {
83
+ ok(true, "shown was called")
84
+ start()
85
+ })
86
+ .tooltip('show')
87
+ })
88
+
89
+ test("should not fire shown event when default prevented", function () {
90
+ stop()
91
+ var tooltip = $('<div title="tooltip title"></div>')
92
+ .on("show.bs.tooltip", function(e) {
93
+ e.preventDefault()
94
+ ok(true, "show was called")
95
+ start()
96
+ })
97
+ .on("shown.bs.tooltip", function() {
98
+ ok(false, "shown was called")
99
+ })
100
+ .tooltip('show')
101
+ })
102
+
103
+ test("should fire hide event", function () {
104
+ stop()
105
+ var tooltip = $('<div title="tooltip title"></div>')
106
+ .on("shown.bs.tooltip", function() {
107
+ $(this).tooltip('hide')
108
+ })
109
+ .on("hide.bs.tooltip", function() {
110
+ ok(true, "hide was called")
111
+ start()
112
+ })
113
+ .tooltip('show')
114
+ })
115
+
116
+ test("should fire hidden event", function () {
117
+ stop()
118
+ var tooltip = $('<div title="tooltip title"></div>')
119
+ .on("shown.bs.tooltip", function() {
120
+ $(this).tooltip('hide')
121
+ })
122
+ .on("hidden.bs.tooltip", function() {
123
+ ok(true, "hidden was called")
124
+ start()
125
+ })
126
+ .tooltip('show')
127
+ })
128
+
129
+ test("should not fire hidden event when default prevented", function () {
130
+ stop()
131
+ var tooltip = $('<div title="tooltip title"></div>')
132
+ .on("shown.bs.tooltip", function() {
133
+ $(this).tooltip('hide')
134
+ })
135
+ .on("hide.bs.tooltip", function(e) {
136
+ e.preventDefault()
137
+ ok(true, "hide was called")
138
+ start()
139
+ })
140
+ .on("hidden.bs.tooltip", function() {
141
+ ok(false, "hidden was called")
142
+ })
143
+ .tooltip('show')
144
+ })
145
+
146
+ test("should not show tooltip if leave event occurs before delay expires", function () {
147
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
148
+ .appendTo('#qunit-fixture')
149
+ .tooltip({ delay: 200 })
150
+
151
+ stop()
152
+
153
+ tooltip.trigger('mouseenter')
154
+
155
+ setTimeout(function () {
156
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
157
+ tooltip.trigger('mouseout')
158
+ setTimeout(function () {
159
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
160
+ start()
161
+ }, 200)
162
+ }, 100)
163
+ })
164
+
165
+ test("should not show tooltip if leave event occurs before delay expires, even if hide delay is 0", function () {
166
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
167
+ .appendTo('#qunit-fixture')
168
+ .tooltip({ delay: { show: 200, hide: 0} })
169
+
170
+ stop()
171
+
172
+ tooltip.trigger('mouseenter')
173
+
174
+ setTimeout(function () {
175
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
176
+ tooltip.trigger('mouseout')
177
+ setTimeout(function () {
178
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
179
+ start()
180
+ }, 200)
181
+ }, 100)
182
+ })
183
+
184
+ test("should wait 200 ms before hiding the tooltip", 3, function () {
185
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
186
+ .appendTo('#qunit-fixture')
187
+ .tooltip({ delay: { show: 0, hide: 200} })
188
+
189
+ stop()
190
+
191
+ tooltip.trigger('mouseenter')
192
+
193
+ setTimeout(function () {
194
+ ok($(".tooltip").is('.fade.in'), 'tooltip is faded in')
195
+ tooltip.trigger('mouseout')
196
+ setTimeout(function () {
197
+ ok($(".tooltip").is('.fade.in'), '100ms:tooltip is still faded in')
198
+ setTimeout(function () {
199
+ ok(!$(".tooltip").is('.in'), 'tooltip removed')
200
+ start()
201
+ }, 150)
202
+ }, 100)
203
+ }, 1)
204
+ })
205
+
206
+ test("should not hide tooltip if leave event occurs, then tooltip is show immediately again", function () {
207
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
208
+ .appendTo('#qunit-fixture')
209
+ .tooltip({ delay: { show: 0, hide: 200} })
210
+
211
+ stop()
212
+
213
+ tooltip.trigger('mouseenter')
214
+
215
+ setTimeout(function () {
216
+ ok($(".tooltip").is('.fade.in'), 'tooltip is faded in')
217
+ tooltip.trigger('mouseout')
218
+ setTimeout(function () {
219
+ ok($(".tooltip").is('.fade.in'), '100ms:tooltip is still faded in')
220
+ tooltip.trigger('mouseenter')
221
+ setTimeout(function () {
222
+ ok($(".tooltip").is('.in'), 'tooltip removed')
223
+ start()
224
+ }, 150)
225
+ }, 100)
226
+ }, 1)
227
+ })
228
+
229
+ test("should not show tooltip if leave event occurs before delay expires", function () {
230
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
231
+ .appendTo('#qunit-fixture')
232
+ .tooltip({ delay: 100 })
233
+ stop()
234
+ tooltip.trigger('mouseenter')
235
+ setTimeout(function () {
236
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
237
+ tooltip.trigger('mouseout')
238
+ setTimeout(function () {
239
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
240
+ start()
241
+ }, 100)
242
+ }, 50)
243
+ })
244
+
245
+ test("should show tooltip if leave event hasn't occured before delay expires", function () {
246
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
247
+ .appendTo('#qunit-fixture')
248
+ .tooltip({ delay: 150 })
249
+ stop()
250
+ tooltip.trigger('mouseenter')
251
+ setTimeout(function () {
252
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
253
+ }, 100)
254
+ setTimeout(function () {
255
+ ok($(".tooltip").is('.fade.in'), 'tooltip has faded in')
256
+ start()
257
+ }, 200)
258
+ })
259
+
260
+ test("should destroy tooltip", function () {
261
+ var tooltip = $('<div/>').tooltip().on('click.foo', function(){})
262
+ ok(tooltip.data('bs.tooltip'), 'tooltip has data')
263
+ ok($._data(tooltip[0], 'events').mouseover && $._data(tooltip[0], 'events').mouseout, 'tooltip has hover event')
264
+ ok($._data(tooltip[0], 'events').click[0].namespace == 'foo', 'tooltip has extra click.foo event')
265
+ tooltip.tooltip('show')
266
+ tooltip.tooltip('destroy')
267
+ ok(!tooltip.hasClass('in'), 'tooltip is hidden')
268
+ ok(!$._data(tooltip[0], 'bs.tooltip'), 'tooltip does not have data')
269
+ ok($._data(tooltip[0], 'events').click[0].namespace == 'foo', 'tooltip still has click.foo')
270
+ ok(!$._data(tooltip[0], 'events').mouseover && !$._data(tooltip[0], 'events').mouseout, 'tooltip does not have any events')
271
+ })
272
+
273
+ test("should show tooltip with delegate selector on click", function () {
274
+ var div = $('<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>')
275
+ var tooltip = div.appendTo('#qunit-fixture')
276
+ .tooltip({ selector: 'a[rel=tooltip]',
277
+ trigger: 'click' })
278
+ div.find('a').trigger('click')
279
+ ok($(".tooltip").is('.fade.in'), 'tooltip is faded in')
280
+ })
281
+
282
+ test("should show tooltip when toggle is called", function () {
283
+ var tooltip = $('<a href="#" rel="tooltip" title="tooltip on toggle"></a>')
284
+ .appendTo('#qunit-fixture')
285
+ .tooltip({trigger: 'manual'})
286
+ .tooltip('toggle')
287
+ ok($(".tooltip").is('.fade.in'), 'tooltip should be toggled in')
288
+ })
289
+
290
+ test("should place tooltips inside the body", function () {
291
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
292
+ .appendTo('#qunit-fixture')
293
+ .tooltip({container:'body'})
294
+ .tooltip('show')
295
+ ok($("body > .tooltip").length, 'inside the body')
296
+ ok(!$("#qunit-fixture > .tooltip").length, 'not found in parent')
297
+ tooltip.tooltip('hide')
298
+ })
299
+
300
+ test("should place tooltip inside window", function(){
301
+ var container = $("<div />").appendTo("body")
302
+ .css({position: "absolute", width: 200, height: 200, bottom: 0, left: 0})
303
+ , tooltip = $("<a href='#' title='Very very very very very very very very long tooltip'>Hover me</a>")
304
+ .css({position: "absolute", top:0, left: 0})
305
+ .appendTo(container)
306
+ .tooltip({placement: "top", animate: false})
307
+ .tooltip("show")
308
+
309
+ stop()
310
+
311
+ setTimeout(function(){
312
+ ok($(".tooltip").offset().left >= 0)
313
+
314
+ start()
315
+ container.remove()
316
+ }, 100)
317
+ })
318
+
319
+ test("should place tooltip on top of element", function(){
320
+ var container = $("<div />").appendTo("body")
321
+ .css({position: "absolute", bottom: 0, left: 0, textAlign: "right", width: 300, height: 300})
322
+ , p = $("<p style='margin-top:200px' />").appendTo(container)
323
+ , tooltiped = $("<a href='#' title='very very very very very very very long tooltip'>Hover me</a>")
324
+ .css({marginTop: 200})
325
+ .appendTo(p)
326
+ .tooltip({placement: "top", animate: false})
327
+ .tooltip("show")
328
+
329
+ stop()
330
+
331
+ setTimeout(function(){
332
+ var tooltip = container.find(".tooltip")
333
+
334
+ start()
335
+ ok(tooltip.offset().top + tooltip.outerHeight() <= tooltiped.offset().top)
336
+ container.remove()
337
+ }, 100)
338
+ })
339
+
340
+ test("should add position class before positioning so that position-specific styles are taken into account", function(){
341
+ $("head").append('<style> .tooltip.right { white-space: nowrap; } .tooltip.right .tooltip-inner { max-width: none; } </style>')
342
+
343
+ var container = $("<div />").appendTo("body")
344
+ , target = $('<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line"></a>')
345
+ .appendTo(container)
346
+ .tooltip({placement: 'right'})
347
+ .tooltip('show')
348
+ , tooltip = container.find(".tooltip")
349
+
350
+ ok( Math.round(target.offset().top + target[0].offsetHeight/2 - tooltip[0].offsetHeight/2) === Math.round(tooltip.offset().top) )
351
+ target.tooltip('hide')
352
+ })
353
+
354
+ test("tooltip title test #1", function () {
355
+ var tooltip = $('<a href="#" rel="tooltip" title="Simple tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>')
356
+ .appendTo('#qunit-fixture')
357
+ .tooltip({
358
+ })
359
+ .tooltip('show')
360
+ equal($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title from title attribute is set')
361
+ tooltip.tooltip('hide')
362
+ ok(!$(".tooltip").length, 'tooltip removed')
363
+ })
364
+
365
+ test("tooltip title test #2", function () {
366
+ var tooltip = $('<a href="#" rel="tooltip" title="Simple tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>')
367
+ .appendTo('#qunit-fixture')
368
+ .tooltip({
369
+ title: 'This is a tooltip with some content'
370
+ })
371
+ .tooltip('show')
372
+ equal($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title is set from title attribute while prefered over title option')
373
+ tooltip.tooltip('hide')
374
+ ok(!$(".tooltip").length, 'tooltip removed')
375
+ })
376
+
377
+ test("tooltip title test #3", function () {
378
+ var tooltip = $('<a href="#" rel="tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>')
379
+ .appendTo('#qunit-fixture')
380
+ .tooltip({
381
+ title: 'This is a tooltip with some content'
382
+ })
383
+ .tooltip('show')
384
+ equal($('.tooltip').children('.tooltip-inner').text(), 'This is a tooltip with some content', 'title from title option is set')
385
+ tooltip.tooltip('hide')
386
+ ok(!$(".tooltip").length, 'tooltip removed')
387
+ })
388
+
389
+ test("tooltips should be placed dynamically, with the dynamic placement option", function () {
390
+ $.support.transition = false
391
+ var ttContainer = $('<div id="dynamic-tt-test"/>').css({
392
+ 'height' : 400
393
+ , 'overflow' : 'hidden'
394
+ , 'position' : 'absolute'
395
+ , 'top' : 0
396
+ , 'left' : 0
397
+ , 'width' : 600})
398
+ .appendTo('body')
399
+
400
+ var topTooltip = $('<div style="display: inline-block; position: absolute; left: 0; top: 0;" rel="tooltip" title="Top tooltip">Top Dynamic Tooltip</div>')
401
+ .appendTo('#dynamic-tt-test')
402
+ .tooltip({placement: 'auto'})
403
+ .tooltip('show')
404
+
405
+
406
+ ok($(".tooltip").is('.bottom'), 'top positioned tooltip is dynamically positioned bottom')
407
+
408
+ topTooltip.tooltip('hide')
409
+
410
+ var rightTooltip = $('<div style="display: inline-block; position: absolute; right: 0;" rel="tooltip" title="Right tooltip">Right Dynamic Tooltip</div>')
411
+ .appendTo('#dynamic-tt-test')
412
+ .tooltip({placement: 'right auto'})
413
+ .tooltip('show')
414
+
415
+ ok($(".tooltip").is('.left'), 'right positioned tooltip is dynamically positioned left')
416
+ rightTooltip.tooltip('hide')
417
+
418
+ var bottomTooltip = $('<div style="display: inline-block; position: absolute; bottom: 0;" rel="tooltip" title="Bottom tooltip">Bottom Dynamic Tooltip</div>')
419
+ .appendTo('#dynamic-tt-test')
420
+ .tooltip({placement: 'auto bottom'})
421
+ .tooltip('show')
422
+
423
+ ok($(".tooltip").is('.top'), 'bottom positioned tooltip is dynamically positioned top')
424
+ bottomTooltip.tooltip('hide')
425
+
426
+ var leftTooltip = $('<div style="display: inline-block; position: absolute; left: 0;" rel="tooltip" title="Left tooltip">Left Dynamic Tooltip</div>')
427
+ .appendTo('#dynamic-tt-test')
428
+ .tooltip({placement: 'auto left'})
429
+ .tooltip('show')
430
+
431
+ ok($(".tooltip").is('.right'), 'left positioned tooltip is dynamically positioned right')
432
+ leftTooltip.tooltip('hide')
433
+
434
+ ttContainer.remove()
435
+ })
436
+
437
+ })
@@ -0,0 +1,13 @@
1
+ $(function () {
2
+
3
+ module("transition")
4
+
5
+ test("should be defined on jquery support object", function () {
6
+ ok($.support.transition !== undefined, 'transition object is defined')
7
+ })
8
+
9
+ test("should provide an end object", function () {
10
+ ok($.support.transition ? $.support.transition.end : true, 'end string is defined')
11
+ })
12
+
13
+ })