gumdrop 0.2.13 → 0.2.14
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.
- data/ChangeLog.md +4 -0
- data/lib/gumdrop.rb +40 -11
- data/lib/gumdrop/cli.rb +12 -5
- data/lib/gumdrop/content.rb +3 -3
- data/lib/gumdrop/dsl.rb +19 -0
- data/lib/gumdrop/generator.rb +0 -17
- data/lib/gumdrop/template/{Gemfile → default/Gemfile} +0 -0
- data/lib/gumdrop/template/{Rakefile → default/Rakefile} +0 -0
- data/lib/gumdrop/template/{config.ru → default/config.ru} +0 -0
- data/lib/gumdrop/template/{data → default/data}/config.yml +0 -0
- data/lib/gumdrop/template/{lib → default/lib}/site.rb +0 -0
- data/lib/gumdrop/template/{lib → default/lib}/view_helpers.rb +0 -0
- data/lib/gumdrop/template/{default.htaccess → default/source/default.htaccess} +0 -0
- data/lib/gumdrop/template/{source → default/source}/favicon.ico +0 -0
- data/lib/gumdrop/template/{source → default/source}/feed.xml.builder.txt +0 -0
- data/lib/gumdrop/template/{source → default/source}/index.html.erb +0 -0
- data/lib/gumdrop/template/{source → default/source}/theme/screen.css.sass +0 -0
- data/lib/gumdrop/template/{source → default/source}/theme/scripts/app.js.coffee +0 -0
- data/lib/gumdrop/template/{source → default/source}/theme/styles/_tools.scss +0 -0
- data/lib/gumdrop/template/{source → default/source}/theme/templates/site.template.slim +0 -0
- data/lib/gumdrop/template/twitter/Gemfile +28 -0
- data/lib/gumdrop/template/twitter/Rakefile +35 -0
- data/lib/gumdrop/template/twitter/config.ru +17 -0
- data/lib/gumdrop/template/twitter/data/config.yml +4 -0
- data/lib/gumdrop/template/twitter/lib/site.rb +43 -0
- data/lib/gumdrop/template/twitter/lib/view_helpers.rb +17 -0
- data/lib/gumdrop/template/twitter/source/_sidebar.html.slim +1 -0
- data/lib/gumdrop/template/twitter/source/container-app.html.slim +89 -0
- data/lib/gumdrop/template/twitter/source/default.htaccess +16 -0
- data/lib/gumdrop/template/twitter/source/favicon.ico +0 -0
- data/lib/gumdrop/template/twitter/source/feed.xml.builder.txt +23 -0
- data/lib/gumdrop/template/twitter/source/fluid.html.slim +134 -0
- data/lib/gumdrop/template/twitter/source/hero.html.slim +49 -0
- data/lib/gumdrop/template/twitter/source/index.html.erb +10 -0
- data/lib/gumdrop/template/twitter/source/theme/screen.css.sass +3 -0
- data/lib/gumdrop/template/twitter/source/theme/scripts/app.js.coffee +4 -0
- data/lib/gumdrop/template/twitter/source/theme/scripts/jquery.js +4 -0
- data/lib/gumdrop/template/twitter/source/theme/styles/_tools.scss +434 -0
- data/lib/gumdrop/template/twitter/source/theme/templates/site.template.slim +19 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/LICENSE +13 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/Makefile +30 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/README.md +115 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/bootstrap-min.css +330 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/bootstrap.css +2362 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/css/docs.css +317 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/ico/bootstrap-apple-114x114.png +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/ico/bootstrap-apple-57x57.png +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/ico/bootstrap-apple-72x72.png +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/ico/favicon.ico +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/img/bird.png +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/img/browsers.png +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/img/example-diagram-01.png +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/img/example-diagram-02.png +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/img/example-diagram-03.png +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/img/grid-18px.png +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/img/twitter-logo-no-bird.png +0 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/js/application.js +52 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/js/google-code-prettify/prettify.css +41 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/assets/js/google-code-prettify/prettify.js +28 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/index.html +1932 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/docs/javascript.html +676 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/examples/container-app.html +119 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/examples/fluid.html +126 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/examples/hero.html +79 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/bootstrap-alerts.js +104 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/bootstrap-dropdown.js +50 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/bootstrap-modal.js +238 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/bootstrap-popover.js +77 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/bootstrap-scrollspy.js +105 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/bootstrap-tabs.js +62 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/bootstrap-twipsy.js +307 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/tests/index.html +38 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/tests/unit/bootstrap-alerts.js +41 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/tests/unit/bootstrap-dropdown.js +52 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/tests/unit/bootstrap-modal.js +151 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/tests/unit/bootstrap-popover.js +76 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/tests/unit/bootstrap-scrollspy.js +31 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/tests/unit/bootstrap-tabs.js +49 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/tests/unit/bootstrap-twipsy.js +81 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/tests/vendor/qunit.css +232 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/js/tests/vendor/qunit.js +1510 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/lib/bootstrap.less +26 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/lib/forms.less +465 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/lib/mixins.less +217 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/lib/patterns.less +1005 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/lib/reset.less +141 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/lib/scaffolding.less +135 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/lib/tables.less +171 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/lib/type.less +187 -0
- data/lib/gumdrop/template/twitter/source/theme/twitter/lib/variables.less +60 -0
- data/lib/gumdrop/version.rb +1 -1
- metadata +98 -27
@@ -0,0 +1,307 @@
|
|
1
|
+
/* ==========================================================
|
2
|
+
* bootstrap-twipsy.js v1.3.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#twipsy
|
4
|
+
* Adapted from the original jQuery.tipsy by Jason Frame
|
5
|
+
* ==========================================================
|
6
|
+
* Copyright 2011 Twitter, Inc.
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
* ========================================================== */
|
20
|
+
|
21
|
+
|
22
|
+
!function( $ ) {
|
23
|
+
|
24
|
+
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
|
25
|
+
* ======================================================= */
|
26
|
+
|
27
|
+
var transitionEnd
|
28
|
+
|
29
|
+
$(document).ready(function () {
|
30
|
+
|
31
|
+
$.support.transition = (function () {
|
32
|
+
var thisBody = document.body || document.documentElement
|
33
|
+
, thisStyle = thisBody.style
|
34
|
+
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
|
35
|
+
return support
|
36
|
+
})()
|
37
|
+
|
38
|
+
// set CSS transition event type
|
39
|
+
if ( $.support.transition ) {
|
40
|
+
transitionEnd = "TransitionEnd"
|
41
|
+
if ( $.browser.webkit ) {
|
42
|
+
transitionEnd = "webkitTransitionEnd"
|
43
|
+
} else if ( $.browser.mozilla ) {
|
44
|
+
transitionEnd = "transitionend"
|
45
|
+
} else if ( $.browser.opera ) {
|
46
|
+
transitionEnd = "oTransitionEnd"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
})
|
51
|
+
|
52
|
+
|
53
|
+
/* TWIPSY PUBLIC CLASS DEFINITION
|
54
|
+
* ============================== */
|
55
|
+
|
56
|
+
var Twipsy = function ( element, options ) {
|
57
|
+
this.$element = $(element)
|
58
|
+
this.options = options
|
59
|
+
this.enabled = true
|
60
|
+
this.fixTitle()
|
61
|
+
}
|
62
|
+
|
63
|
+
Twipsy.prototype = {
|
64
|
+
|
65
|
+
show: function() {
|
66
|
+
var pos
|
67
|
+
, actualWidth
|
68
|
+
, actualHeight
|
69
|
+
, placement
|
70
|
+
, $tip
|
71
|
+
, tp
|
72
|
+
|
73
|
+
if (this.getTitle() && this.enabled) {
|
74
|
+
$tip = this.tip()
|
75
|
+
this.setContent()
|
76
|
+
|
77
|
+
if (this.options.animate) {
|
78
|
+
$tip.addClass('fade')
|
79
|
+
}
|
80
|
+
|
81
|
+
$tip
|
82
|
+
.remove()
|
83
|
+
.css({ top: 0, left: 0, display: 'block' })
|
84
|
+
.prependTo(document.body)
|
85
|
+
|
86
|
+
pos = $.extend({}, this.$element.offset(), {
|
87
|
+
width: this.$element[0].offsetWidth
|
88
|
+
, height: this.$element[0].offsetHeight
|
89
|
+
})
|
90
|
+
|
91
|
+
actualWidth = $tip[0].offsetWidth
|
92
|
+
actualHeight = $tip[0].offsetHeight
|
93
|
+
placement = _.maybeCall(this.options.placement, this.$element[0])
|
94
|
+
|
95
|
+
switch (placement) {
|
96
|
+
case 'below':
|
97
|
+
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
|
98
|
+
break
|
99
|
+
case 'above':
|
100
|
+
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
|
101
|
+
break
|
102
|
+
case 'left':
|
103
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
|
104
|
+
break
|
105
|
+
case 'right':
|
106
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
|
107
|
+
break
|
108
|
+
}
|
109
|
+
|
110
|
+
$tip
|
111
|
+
.css(tp)
|
112
|
+
.addClass(placement)
|
113
|
+
.addClass('in')
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
, setContent: function () {
|
118
|
+
var $tip = this.tip()
|
119
|
+
$tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
|
120
|
+
$tip[0].className = 'twipsy'
|
121
|
+
}
|
122
|
+
|
123
|
+
, hide: function() {
|
124
|
+
var that = this
|
125
|
+
, $tip = this.tip()
|
126
|
+
|
127
|
+
$tip.removeClass('in')
|
128
|
+
|
129
|
+
function removeElement () {
|
130
|
+
$tip.remove()
|
131
|
+
}
|
132
|
+
|
133
|
+
$.support.transition && this.$tip.hasClass('fade') ?
|
134
|
+
$tip.bind(transitionEnd, removeElement) :
|
135
|
+
removeElement()
|
136
|
+
}
|
137
|
+
|
138
|
+
, fixTitle: function() {
|
139
|
+
var $e = this.$element
|
140
|
+
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
141
|
+
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
, getTitle: function() {
|
146
|
+
var title
|
147
|
+
, $e = this.$element
|
148
|
+
, o = this.options
|
149
|
+
|
150
|
+
this.fixTitle()
|
151
|
+
|
152
|
+
if (typeof o.title == 'string') {
|
153
|
+
title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
|
154
|
+
} else if (typeof o.title == 'function') {
|
155
|
+
title = o.title.call($e[0])
|
156
|
+
}
|
157
|
+
|
158
|
+
title = ('' + title).replace(/(^\s*|\s*$)/, "")
|
159
|
+
|
160
|
+
return title || o.fallback
|
161
|
+
}
|
162
|
+
|
163
|
+
, tip: function() {
|
164
|
+
if (!this.$tip) {
|
165
|
+
this.$tip = $('<div class="twipsy" />').html('<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>')
|
166
|
+
}
|
167
|
+
return this.$tip
|
168
|
+
}
|
169
|
+
|
170
|
+
, validate: function() {
|
171
|
+
if (!this.$element[0].parentNode) {
|
172
|
+
this.hide()
|
173
|
+
this.$element = null
|
174
|
+
this.options = null
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
, enable: function() {
|
179
|
+
this.enabled = true
|
180
|
+
}
|
181
|
+
|
182
|
+
, disable: function() {
|
183
|
+
this.enabled = false
|
184
|
+
}
|
185
|
+
|
186
|
+
, toggleEnabled: function() {
|
187
|
+
this.enabled = !this.enabled
|
188
|
+
}
|
189
|
+
|
190
|
+
}
|
191
|
+
|
192
|
+
|
193
|
+
/* TWIPSY PRIVATE METHODS
|
194
|
+
* ====================== */
|
195
|
+
|
196
|
+
var _ = {
|
197
|
+
|
198
|
+
maybeCall: function ( thing, ctx ) {
|
199
|
+
return (typeof thing == 'function') ? (thing.call(ctx)) : thing
|
200
|
+
}
|
201
|
+
|
202
|
+
}
|
203
|
+
|
204
|
+
|
205
|
+
/* TWIPSY PLUGIN DEFINITION
|
206
|
+
* ======================== */
|
207
|
+
|
208
|
+
$.fn.twipsy = function (options) {
|
209
|
+
$.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
|
210
|
+
return this
|
211
|
+
}
|
212
|
+
|
213
|
+
$.fn.twipsy.initWith = function (options, Constructor, name) {
|
214
|
+
var twipsy
|
215
|
+
, binder
|
216
|
+
, eventIn
|
217
|
+
, eventOut
|
218
|
+
|
219
|
+
if (options === true) {
|
220
|
+
return this.data(name)
|
221
|
+
} else if (typeof options == 'string') {
|
222
|
+
twipsy = this.data(name)
|
223
|
+
if (twipsy) {
|
224
|
+
twipsy[options]()
|
225
|
+
}
|
226
|
+
return this
|
227
|
+
}
|
228
|
+
|
229
|
+
options = $.extend({}, $.fn[name].defaults, options)
|
230
|
+
|
231
|
+
function get(ele) {
|
232
|
+
var twipsy = $.data(ele, name)
|
233
|
+
|
234
|
+
if (!twipsy) {
|
235
|
+
twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
|
236
|
+
$.data(ele, name, twipsy)
|
237
|
+
}
|
238
|
+
|
239
|
+
return twipsy
|
240
|
+
}
|
241
|
+
|
242
|
+
function enter() {
|
243
|
+
var twipsy = get(this)
|
244
|
+
twipsy.hoverState = 'in'
|
245
|
+
|
246
|
+
if (options.delayIn == 0) {
|
247
|
+
twipsy.show()
|
248
|
+
} else {
|
249
|
+
twipsy.fixTitle()
|
250
|
+
setTimeout(function() {
|
251
|
+
if (twipsy.hoverState == 'in') {
|
252
|
+
twipsy.show()
|
253
|
+
}
|
254
|
+
}, options.delayIn)
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
258
|
+
function leave() {
|
259
|
+
var twipsy = get(this)
|
260
|
+
twipsy.hoverState = 'out'
|
261
|
+
if (options.delayOut == 0) {
|
262
|
+
twipsy.hide()
|
263
|
+
} else {
|
264
|
+
setTimeout(function() {
|
265
|
+
if (twipsy.hoverState == 'out') {
|
266
|
+
twipsy.hide()
|
267
|
+
}
|
268
|
+
}, options.delayOut)
|
269
|
+
}
|
270
|
+
}
|
271
|
+
|
272
|
+
if (!options.live) {
|
273
|
+
this.each(function() {
|
274
|
+
get(this)
|
275
|
+
})
|
276
|
+
}
|
277
|
+
|
278
|
+
if (options.trigger != 'manual') {
|
279
|
+
binder = options.live ? 'live' : 'bind'
|
280
|
+
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus'
|
281
|
+
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
|
282
|
+
this[binder](eventIn, enter)[binder](eventOut, leave)
|
283
|
+
}
|
284
|
+
|
285
|
+
return this
|
286
|
+
}
|
287
|
+
|
288
|
+
$.fn.twipsy.Twipsy = Twipsy
|
289
|
+
|
290
|
+
$.fn.twipsy.defaults = {
|
291
|
+
animate: true
|
292
|
+
, delayIn: 0
|
293
|
+
, delayOut: 0
|
294
|
+
, fallback: ''
|
295
|
+
, placement: 'above'
|
296
|
+
, html: false
|
297
|
+
, live: false
|
298
|
+
, offset: 0
|
299
|
+
, title: 'title'
|
300
|
+
, trigger: 'hover'
|
301
|
+
}
|
302
|
+
|
303
|
+
$.fn.twipsy.elementOptions = function(ele, options) {
|
304
|
+
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
|
305
|
+
}
|
306
|
+
|
307
|
+
}( window.jQuery || window.ender )
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Bootstrap Plugin Test Suite</title>
|
5
|
+
|
6
|
+
<!-- jquery -->
|
7
|
+
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
|
8
|
+
|
9
|
+
<!-- qunit -->
|
10
|
+
<link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen" />
|
11
|
+
<script src="vendor/qunit.js"></script>
|
12
|
+
|
13
|
+
<!-- plugin sources -->
|
14
|
+
<script src="../../js/bootstrap-alerts.js"></script>
|
15
|
+
<script src="../../js/bootstrap-dropdown.js"></script>
|
16
|
+
<script src="../../js/bootstrap-modal.js"></script>
|
17
|
+
<script src="../../js/bootstrap-tabs.js"></script>
|
18
|
+
<script src="../../js/bootstrap-twipsy.js"></script>
|
19
|
+
<script src="../../js/bootstrap-popover.js"></script>
|
20
|
+
|
21
|
+
<!-- unit tests -->
|
22
|
+
<script src="unit/bootstrap-alerts.js"></script>
|
23
|
+
<script src="unit/bootstrap-dropdown.js"></script>
|
24
|
+
<script src="unit/bootstrap-modal.js"></script>
|
25
|
+
<script src="unit/bootstrap-popover.js"></script>
|
26
|
+
<script src="unit/bootstrap-tabs.js"></script>
|
27
|
+
<script src="unit/bootstrap-twipsy.js"></script>
|
28
|
+
|
29
|
+
<body>
|
30
|
+
<div>
|
31
|
+
<h1 id="qunit-header">Bootstrap Plugin Test Suite</h1>
|
32
|
+
<h2 id="qunit-banner"></h2>
|
33
|
+
<h2 id="qunit-userAgent"></h2>
|
34
|
+
<ol id="qunit-tests"></ol>
|
35
|
+
<div id="qunit-runoff"></div>
|
36
|
+
</div>
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
$(function () {
|
2
|
+
|
3
|
+
module("bootstrap-alerts")
|
4
|
+
|
5
|
+
test("should be defined on jquery object", function () {
|
6
|
+
ok($(document.body).alert, 'alert method is defined')
|
7
|
+
})
|
8
|
+
|
9
|
+
test("should return element", function () {
|
10
|
+
ok($(document.body).alert()[0] == document.body, 'document.body returned')
|
11
|
+
})
|
12
|
+
|
13
|
+
test("should fade element out on clicking .close", function () {
|
14
|
+
var alertHTML = '<div class="alert-message warning fade in">'
|
15
|
+
+ '<a class="close" href="#">×</a>'
|
16
|
+
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
|
17
|
+
+ '</div>'
|
18
|
+
, alert = $(alertHTML).alert()
|
19
|
+
|
20
|
+
alert.find('.close').click()
|
21
|
+
|
22
|
+
ok(!alert.hasClass('in'), 'remove .in class on .close click')
|
23
|
+
})
|
24
|
+
|
25
|
+
test("should remove element when clicking .close", function () {
|
26
|
+
$.support.transition = false
|
27
|
+
|
28
|
+
var alertHTML = '<div class="alert-message warning fade in">'
|
29
|
+
+ '<a class="close" href="#">×</a>'
|
30
|
+
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
|
31
|
+
+ '</div>'
|
32
|
+
, alert = $(alertHTML).appendTo('#qunit-runoff').alert()
|
33
|
+
|
34
|
+
ok($('#qunit-runoff').find('.alert-message').length, 'element added to dom')
|
35
|
+
|
36
|
+
alert.find('.close').click()
|
37
|
+
|
38
|
+
ok(!$('#qunit-runoff').find('.alert-message').length, 'element removed from dom')
|
39
|
+
})
|
40
|
+
|
41
|
+
})
|
@@ -0,0 +1,52 @@
|
|
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
|
+
})
|
@@ -0,0 +1,151 @@
|
|
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
|
+
})
|