namey 0.0.2 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +22 -1
- data/README.markdown +105 -0
- data/Rakefile +54 -0
- data/api/Gemfile +10 -0
- data/api/config.ru +8 -0
- data/api/namey_app.rb +50 -0
- data/api/public/LICENSE +176 -0
- data/api/public/Makefile +30 -0
- data/api/public/README.md +105 -0
- data/api/public/api.js +76 -0
- data/api/public/bootstrap.css +2467 -0
- data/api/public/bootstrap.min.css +356 -0
- data/api/public/docs/assets/css/docs.css +317 -0
- data/api/public/docs/assets/ico/bootstrap-apple-114x114.png +0 -0
- data/api/public/docs/assets/ico/bootstrap-apple-57x57.png +0 -0
- data/api/public/docs/assets/ico/bootstrap-apple-72x72.png +0 -0
- data/api/public/docs/assets/ico/favicon.ico +0 -0
- data/api/public/docs/assets/img/bird.png +0 -0
- data/api/public/docs/assets/img/browsers.png +0 -0
- data/api/public/docs/assets/img/example-diagram-01.png +0 -0
- data/api/public/docs/assets/img/example-diagram-02.png +0 -0
- data/api/public/docs/assets/img/example-diagram-03.png +0 -0
- data/api/public/docs/assets/img/grid-18px.png +0 -0
- data/api/public/docs/assets/img/twitter-logo-no-bird.png +0 -0
- data/api/public/docs/assets/js/application.js +52 -0
- data/api/public/docs/assets/js/google-code-prettify/prettify.css +94 -0
- data/api/public/docs/assets/js/google-code-prettify/prettify.js +28 -0
- data/api/public/docs/index.html +2037 -0
- data/api/public/docs/javascript.html +798 -0
- data/api/public/examples/container-app.html +119 -0
- data/api/public/examples/fluid.html +122 -0
- data/api/public/examples/hero.html +79 -0
- data/api/public/js/bootstrap-alerts.js +113 -0
- data/api/public/js/bootstrap-buttons.js +62 -0
- data/api/public/js/bootstrap-dropdown.js +55 -0
- data/api/public/js/bootstrap-modal.js +260 -0
- data/api/public/js/bootstrap-popover.js +86 -0
- data/api/public/js/bootstrap-scrollspy.js +107 -0
- data/api/public/js/bootstrap-tabs.js +80 -0
- data/api/public/js/bootstrap-twipsy.js +310 -0
- data/api/public/js/tests/index.html +40 -0
- data/api/public/js/tests/unit/bootstrap-alerts.js +41 -0
- data/api/public/js/tests/unit/bootstrap-buttons.js +42 -0
- data/api/public/js/tests/unit/bootstrap-dropdown.js +52 -0
- data/api/public/js/tests/unit/bootstrap-modal.js +151 -0
- data/api/public/js/tests/unit/bootstrap-popover.js +76 -0
- data/api/public/js/tests/unit/bootstrap-scrollspy.js +31 -0
- data/api/public/js/tests/unit/bootstrap-tabs.js +77 -0
- data/api/public/js/tests/unit/bootstrap-twipsy.js +81 -0
- data/api/public/js/tests/vendor/qunit.css +232 -0
- data/api/public/js/tests/vendor/qunit.js +1510 -0
- data/api/public/lib/bootstrap.less +26 -0
- data/api/public/lib/forms.less +479 -0
- data/api/public/lib/mixins.less +222 -0
- data/api/public/lib/patterns.less +1060 -0
- data/api/public/lib/reset.less +141 -0
- data/api/public/lib/scaffolding.less +137 -0
- data/api/public/lib/tables.less +224 -0
- data/api/public/lib/type.less +187 -0
- data/api/public/lib/variables.less +60 -0
- data/api/public/ui.js +42 -0
- data/api/views/index.erb +211 -0
- data/bin/{load-data → namey-load-data} +7 -1
- data/bin/random-name +4 -1
- data/data/dist.all.last +88799 -0
- data/data/names.db +0 -0
- data/lib/namey.rb +12 -5
- data/lib/namey/generator.rb +79 -10
- data/lib/namey/parser.rb +79 -16
- data/lib/namey/version.rb +2 -1
- data/namey.gemspec +8 -2
- data/spec/generator_spec.rb +54 -0
- data/spec/spec_helper.rb +19 -0
- metadata +95 -9
@@ -0,0 +1,42 @@
|
|
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
|
+
})
|
@@ -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
|
+
})
|
@@ -0,0 +1,76 @@
|
|
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
|
+
})
|
@@ -0,0 +1,31 @@
|
|
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
|
+
})
|
@@ -0,0 +1,77 @@
|
|
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
|
+
})
|
@@ -0,0 +1,81 @@
|
|
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
|
+
})
|