rvnstat 1.0.4
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.
- checksums.yaml +7 -0
- data/._README.md +0 -0
- data/._ss.png +0 -0
- data/.gitignore +17 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +1 -0
- data/bin/._rvnstat +0 -0
- data/bin/rvnstat +9 -0
- data/config.ru +4 -0
- data/config.yml +3 -0
- data/lib/._app.rb +0 -0
- data/lib/._config.rb +0 -0
- data/lib/._require.rb +0 -0
- data/lib/._rvnstat.rb +0 -0
- data/lib/._vnstat.rb +0 -0
- data/lib/app.rb +102 -0
- data/lib/config.rb +13 -0
- data/lib/require.rb +10 -0
- data/lib/rvnstat.rb +5 -0
- data/lib/rvnstat/._version.rb +0 -0
- data/lib/rvnstat/version.rb +3 -0
- data/lib/vnstat.rb +74 -0
- data/public/CNAME +1 -0
- data/public/CONTRIBUTING.md +192 -0
- data/public/Gruntfile.js +418 -0
- data/public/LICENSE +21 -0
- data/public/README.md +173 -0
- data/public/_config.yml +35 -0
- data/public/bower.json +24 -0
- data/public/browserstack.json +44 -0
- data/public/composer.json +25 -0
- data/public/dist/css/._custom.css +0 -0
- data/public/dist/css/bootstrap-theme.css +347 -0
- data/public/dist/css/bootstrap-theme.css.map +1 -0
- data/public/dist/css/bootstrap-theme.min.css +7 -0
- data/public/dist/css/bootstrap.css +5831 -0
- data/public/dist/css/bootstrap.css.map +1 -0
- data/public/dist/css/bootstrap.min.css +7 -0
- data/public/dist/css/custom.css +20 -0
- data/public/dist/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/dist/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/dist/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/dist/js/bootstrap.js +1951 -0
- data/public/dist/js/bootstrap.min.js +6 -0
- data/public/docs/LICENSE +319 -0
- data/public/docs/_data/glyphicons.yml +203 -0
- data/public/docs/_data/showcase.yml +19 -0
- data/public/docs/_includes/ads.html +1 -0
- data/public/docs/_includes/customizer-variables.html +1690 -0
- data/public/docs/_includes/footer.html +70 -0
- data/public/docs/_includes/header.html +42 -0
- data/public/docs/_includes/nav-about.html +9 -0
- data/public/docs/_includes/nav-components.html +138 -0
- data/public/docs/_includes/nav-css.html +127 -0
- data/public/docs/_includes/nav-customize.html +46 -0
- data/public/docs/_includes/nav-getting-started.html +62 -0
- data/public/docs/_includes/nav-javascript.html +89 -0
- data/public/docs/_includes/nav-main.html +36 -0
- data/public/docs/_includes/nav-migration.html +12 -0
- data/public/docs/_includes/social-buttons.html +16 -0
- data/public/docs/_layouts/default.html +55 -0
- data/public/docs/_layouts/home.html +18 -0
- data/public/docs/about.html +149 -0
- data/public/docs/assets/css/docs.css +1394 -0
- data/public/docs/assets/css/docs.min.css +6 -0
- data/public/docs/assets/css/pygments-manni.css +66 -0
- data/public/docs/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
- data/public/docs/assets/ico/favicon.ico +0 -0
- data/public/docs/assets/img/components.png +0 -0
- data/public/docs/assets/img/devices.png +0 -0
- data/public/docs/assets/img/sass-less.png +0 -0
- data/public/docs/assets/js/application.js +101 -0
- data/public/docs/assets/js/customize.min.js +49 -0
- data/public/docs/assets/js/customizer.js +348 -0
- data/public/docs/assets/js/docs.min.js +16 -0
- data/public/docs/assets/js/ie8-responsive-file-warning.js +12 -0
- data/public/docs/assets/js/raw-files.min.js +8 -0
- data/public/docs/assets/js/vendor/blob.js +166 -0
- data/public/docs/assets/js/vendor/filesaver.js +236 -0
- data/public/docs/assets/js/vendor/holder.js +645 -0
- data/public/docs/assets/js/vendor/jszip.js +1474 -0
- data/public/docs/assets/js/vendor/less.min.js +16 -0
- data/public/docs/assets/js/vendor/uglify.min.js +14 -0
- data/public/docs/components.html +3001 -0
- data/public/docs/css.html +3346 -0
- data/public/docs/customize.html +356 -0
- data/public/docs/customizer-nav.jade +15 -0
- data/public/docs/customizer-variables.jade +21 -0
- data/public/docs/dist/css/bootstrap-theme.css.map +1 -0
- data/public/docs/dist/css/bootstrap-theme.min.css +7 -0
- data/public/docs/dist/css/bootstrap.css.map +1 -0
- data/public/docs/dist/css/bootstrap.min.css +7 -0
- data/public/docs/dist/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/docs/dist/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/docs/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/docs/dist/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/docs/dist/js/bootstrap.min.js +7 -0
- data/public/docs/examples/blog/blog.css +168 -0
- data/public/docs/examples/blog/index.html +171 -0
- data/public/docs/examples/carousel/carousel.css +148 -0
- data/public/docs/examples/carousel/index.html +206 -0
- data/public/docs/examples/cover/cover.css +161 -0
- data/public/docs/examples/cover/index.html +75 -0
- data/public/docs/examples/dashboard/dashboard.css +93 -0
- data/public/docs/examples/dashboard/index.html +243 -0
- data/public/docs/examples/grid/grid.css +28 -0
- data/public/docs/examples/grid/index.html +152 -0
- data/public/docs/examples/jumbotron-narrow/index.html +82 -0
- data/public/docs/examples/jumbotron-narrow/jumbotron-narrow.css +79 -0
- data/public/docs/examples/jumbotron/index.html +99 -0
- data/public/docs/examples/jumbotron/jumbotron.css +5 -0
- data/public/docs/examples/justified-nav/index.html +84 -0
- data/public/docs/examples/justified-nav/justified-nav.css +88 -0
- data/public/docs/examples/navbar-fixed-top/index.html +91 -0
- data/public/docs/examples/navbar-fixed-top/navbar-fixed-top.css +4 -0
- data/public/docs/examples/navbar-static-top/index.html +92 -0
- data/public/docs/examples/navbar-static-top/navbar-static-top.css +7 -0
- data/public/docs/examples/navbar/index.html +90 -0
- data/public/docs/examples/navbar/navbar.css +8 -0
- data/public/docs/examples/non-responsive/index.html +105 -0
- data/public/docs/examples/non-responsive/non-responsive.css +120 -0
- data/public/docs/examples/offcanvas/index.html +130 -0
- data/public/docs/examples/offcanvas/offcanvas.css +51 -0
- data/public/docs/examples/offcanvas/offcanvas.js +5 -0
- data/public/docs/examples/screenshots/blog.jpg +0 -0
- data/public/docs/examples/screenshots/carousel.jpg +0 -0
- data/public/docs/examples/screenshots/cover.jpg +0 -0
- data/public/docs/examples/screenshots/dashboard.jpg +0 -0
- data/public/docs/examples/screenshots/grid.jpg +0 -0
- data/public/docs/examples/screenshots/jumbotron-narrow.jpg +0 -0
- data/public/docs/examples/screenshots/jumbotron.jpg +0 -0
- data/public/docs/examples/screenshots/justified-nav.jpg +0 -0
- data/public/docs/examples/screenshots/navbar-fixed.jpg +0 -0
- data/public/docs/examples/screenshots/navbar-static.jpg +0 -0
- data/public/docs/examples/screenshots/navbar.jpg +0 -0
- data/public/docs/examples/screenshots/non-responsive.jpg +0 -0
- data/public/docs/examples/screenshots/offcanvas.jpg +0 -0
- data/public/docs/examples/screenshots/sign-in.jpg +0 -0
- data/public/docs/examples/screenshots/starter-template.jpg +0 -0
- data/public/docs/examples/screenshots/sticky-footer-navbar.jpg +0 -0
- data/public/docs/examples/screenshots/sticky-footer.jpg +0 -0
- data/public/docs/examples/screenshots/theme.jpg +0 -0
- data/public/docs/examples/signin/index.html +50 -0
- data/public/docs/examples/signin/signin.css +40 -0
- data/public/docs/examples/starter-template/index.html +68 -0
- data/public/docs/examples/starter-template/starter-template.css +7 -0
- data/public/docs/examples/sticky-footer-navbar/index.html +91 -0
- data/public/docs/examples/sticky-footer-navbar/sticky-footer-navbar.css +45 -0
- data/public/docs/examples/sticky-footer/index.html +55 -0
- data/public/docs/examples/sticky-footer/sticky-footer.css +38 -0
- data/public/docs/examples/theme/index.html +384 -0
- data/public/docs/examples/theme/theme.css +14 -0
- data/public/docs/getting-started.html +773 -0
- data/public/docs/grunt/bs-glyphicons-data-generator.js +33 -0
- data/public/docs/grunt/bs-lessdoc-parser.js +236 -0
- data/public/docs/grunt/bs-raw-files-generator.js +31 -0
- data/public/docs/index.html +72 -0
- data/public/docs/javascript.html +2141 -0
- data/public/docs/migration.html +423 -0
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/js/._exporting.js +0 -0
- data/public/js/._highcharts-all.js +0 -0
- data/public/js/._jquery-min.js +0 -0
- data/public/js/.jscs.json +15 -0
- data/public/js/.jshintrc +14 -0
- data/public/js/affix.js +137 -0
- data/public/js/alert.js +88 -0
- data/public/js/bootstrap.min.js +6 -0
- data/public/js/button.js +107 -0
- data/public/js/carousel.js +205 -0
- data/public/js/collapse.js +170 -0
- data/public/js/dropdown.js +147 -0
- data/public/js/highcharts.js +294 -0
- data/public/js/jquery-1.11.0.min.js +4 -0
- data/public/js/modal.js +243 -0
- data/public/js/popover.js +110 -0
- data/public/js/scrollspy.js +153 -0
- data/public/js/tab.js +125 -0
- data/public/js/tests/index.html +54 -0
- data/public/js/tests/unit/affix.js +50 -0
- data/public/js/tests/unit/alert.js +62 -0
- data/public/js/tests/unit/button.js +122 -0
- data/public/js/tests/unit/carousel.js +110 -0
- data/public/js/tests/unit/collapse.js +164 -0
- data/public/js/tests/unit/dropdown.js +218 -0
- data/public/js/tests/unit/modal.js +195 -0
- data/public/js/tests/unit/phantom.js +69 -0
- data/public/js/tests/unit/popover.js +133 -0
- data/public/js/tests/unit/scrollspy.js +36 -0
- data/public/js/tests/unit/tab.js +86 -0
- data/public/js/tests/unit/tooltip.js +432 -0
- data/public/js/tests/vendor/jquery.js +6 -0
- data/public/js/tests/vendor/qunit.css +245 -0
- data/public/js/tests/vendor/qunit.js +2210 -0
- data/public/js/tooltip.js +399 -0
- data/public/js/transition.js +48 -0
- data/public/less/.csscomb.json +297 -0
- data/public/less/.csslintrc +19 -0
- data/public/less/alerts.less +67 -0
- data/public/less/badges.less +55 -0
- data/public/less/bootstrap.less +49 -0
- data/public/less/breadcrumbs.less +26 -0
- data/public/less/button-groups.less +226 -0
- data/public/less/buttons.less +155 -0
- data/public/less/carousel.less +232 -0
- data/public/less/close.less +33 -0
- data/public/less/code.less +63 -0
- data/public/less/component-animations.less +29 -0
- data/public/less/dropdowns.less +213 -0
- data/public/less/forms.less +419 -0
- data/public/less/glyphicons.less +233 -0
- data/public/less/grid.less +100 -0
- data/public/less/input-groups.less +157 -0
- data/public/less/jumbotron.less +44 -0
- data/public/less/labels.less +64 -0
- data/public/less/list-group.less +110 -0
- data/public/less/media.less +56 -0
- data/public/less/mixins.less +926 -0
- data/public/less/modals.less +138 -0
- data/public/less/navbar.less +616 -0
- data/public/less/navs.less +242 -0
- data/public/less/normalize.less +423 -0
- data/public/less/pager.less +55 -0
- data/public/less/pagination.less +88 -0
- data/public/less/panels.less +230 -0
- data/public/less/popovers.less +133 -0
- data/public/less/print.less +101 -0
- data/public/less/progress-bars.less +80 -0
- data/public/less/responsive-utilities.less +93 -0
- data/public/less/scaffolding.less +134 -0
- data/public/less/tables.less +233 -0
- data/public/less/theme.less +247 -0
- data/public/less/thumbnails.less +36 -0
- data/public/less/tooltip.less +95 -0
- data/public/less/type.less +296 -0
- data/public/less/utilities.less +56 -0
- data/public/less/variables.less +827 -0
- data/public/less/wells.less +29 -0
- data/public/package.json +71 -0
- data/public/test-infra/README.md +100 -0
- data/public/test-infra/npm-shrinkwrap.canonical.json +1 -0
- data/public/test-infra/requirements.txt +1 -0
- data/public/test-infra/s3_cache.py +107 -0
- data/public/test-infra/sauce_browsers.yml +83 -0
- data/public/test-infra/shrinkwrap.js +24 -0
- data/public/test-infra/uncached-npm-install.sh +4 -0
- data/rvnstat.gemspec +26 -0
- data/rvnstat.yml +3 -0
- data/ss.png +0 -0
- data/untitled.txt +0 -0
- data/views/._hourly.erb +0 -0
- data/views/._index.erb +0 -0
- data/views/._live_traffic.erb +0 -0
- data/views/._monthly.erb +0 -0
- data/views/._top_ten.erb +0 -0
- data/views/day_detail.erb +44 -0
- data/views/day_total.erb +42 -0
- data/views/graph_test.erb +2 -0
- data/views/hourly.erb +19 -0
- data/views/index.erb +71 -0
- data/views/layout.erb +28 -0
- data/views/live_traffic.erb +57 -0
- data/views/monthly.erb +21 -0
- data/views/top_ten.erb +21 -0
- metadata +385 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
$(function () {
|
|
2
|
+
|
|
3
|
+
module('collapse')
|
|
4
|
+
|
|
5
|
+
test('should provide no conflict', function () {
|
|
6
|
+
var collapse = $.fn.collapse.noConflict()
|
|
7
|
+
ok(!$.fn.collapse, 'collapse was set back to undefined (org value)')
|
|
8
|
+
$.fn.collapse = collapse
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('should be defined on jquery object', function () {
|
|
12
|
+
ok($(document.body).collapse, 'collapse method is defined')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('should return element', function () {
|
|
16
|
+
ok($(document.body).collapse()[0] == document.body, 'document.body returned')
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
test('should show a collapsed element', function () {
|
|
20
|
+
var el = $('<div class="collapse"></div>').collapse('show')
|
|
21
|
+
ok(el.hasClass('in'), 'has class in')
|
|
22
|
+
ok(/height/.test(el.attr('style')), 'has height set')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('should hide a collapsed element', function () {
|
|
26
|
+
var el = $('<div class="collapse"></div>').collapse('hide')
|
|
27
|
+
ok(!el.hasClass('in'), 'does not have class in')
|
|
28
|
+
ok(/height/.test(el.attr('style')), 'has height set')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('should not fire shown when show is prevented', function () {
|
|
32
|
+
$.support.transition = false
|
|
33
|
+
stop()
|
|
34
|
+
$('<div class="collapse"/>')
|
|
35
|
+
.on('show.bs.collapse', function (e) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
ok(true);
|
|
38
|
+
start();
|
|
39
|
+
})
|
|
40
|
+
.on('shown.bs.collapse', function () {
|
|
41
|
+
ok(false);
|
|
42
|
+
})
|
|
43
|
+
.collapse('show')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('should reset style to auto after finishing opening collapse', function () {
|
|
47
|
+
$.support.transition = false
|
|
48
|
+
stop()
|
|
49
|
+
$('<div class="collapse" style="height: 0px"/>')
|
|
50
|
+
.on('show.bs.collapse', function () {
|
|
51
|
+
ok(this.style.height == '0px')
|
|
52
|
+
})
|
|
53
|
+
.on('shown.bs.collapse', function () {
|
|
54
|
+
ok(this.style.height == 'auto')
|
|
55
|
+
start()
|
|
56
|
+
})
|
|
57
|
+
.collapse('show')
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
test('should add active class to target when collapse shown', function () {
|
|
61
|
+
$.support.transition = false
|
|
62
|
+
stop()
|
|
63
|
+
|
|
64
|
+
var target = $('<a data-toggle="collapse" href="#test1"></a>')
|
|
65
|
+
.appendTo($('#qunit-fixture'))
|
|
66
|
+
|
|
67
|
+
var collapsible = $('<div id="test1"></div>')
|
|
68
|
+
.appendTo($('#qunit-fixture'))
|
|
69
|
+
.on('show.bs.collapse', function () {
|
|
70
|
+
ok(!target.hasClass('collapsed'))
|
|
71
|
+
start()
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
target.click()
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
test('should remove active class to target when collapse hidden', function () {
|
|
78
|
+
$.support.transition = false
|
|
79
|
+
stop()
|
|
80
|
+
|
|
81
|
+
var target = $('<a data-toggle="collapse" href="#test1"></a>')
|
|
82
|
+
.appendTo($('#qunit-fixture'))
|
|
83
|
+
|
|
84
|
+
var collapsible = $('<div id="test1" class="in"></div>')
|
|
85
|
+
.appendTo($('#qunit-fixture'))
|
|
86
|
+
.on('hide.bs.collapse', function () {
|
|
87
|
+
ok(target.hasClass('collapsed'))
|
|
88
|
+
start()
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
target.click()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('should remove active class from inactive accordion targets', function () {
|
|
95
|
+
$.support.transition = false
|
|
96
|
+
stop()
|
|
97
|
+
|
|
98
|
+
var accordion = $('<div id="accordion"><div class="accordion-group"></div><div class="accordion-group"></div><div class="accordion-group"></div></div>')
|
|
99
|
+
.appendTo($('#qunit-fixture'))
|
|
100
|
+
|
|
101
|
+
var target1 = $('<a data-toggle="collapse" href="#body1" data-parent="#accordion"></a>')
|
|
102
|
+
.appendTo(accordion.find('.accordion-group').eq(0))
|
|
103
|
+
|
|
104
|
+
var collapsible1 = $('<div id="body1" class="in"></div>')
|
|
105
|
+
.appendTo(accordion.find('.accordion-group').eq(0))
|
|
106
|
+
|
|
107
|
+
var target2 = $('<a class="collapsed" data-toggle="collapse" href="#body2" data-parent="#accordion"></a>')
|
|
108
|
+
.appendTo(accordion.find('.accordion-group').eq(1))
|
|
109
|
+
|
|
110
|
+
var collapsible2 = $('<div id="body2"></div>')
|
|
111
|
+
.appendTo(accordion.find('.accordion-group').eq(1))
|
|
112
|
+
|
|
113
|
+
var target3 = $('<a class="collapsed" data-toggle="collapse" href="#body3" data-parent="#accordion"></a>')
|
|
114
|
+
.appendTo(accordion.find('.accordion-group').eq(2))
|
|
115
|
+
|
|
116
|
+
var collapsible3 = $('<div id="body3"></div>')
|
|
117
|
+
.appendTo(accordion.find('.accordion-group').eq(2))
|
|
118
|
+
.on('show.bs.collapse', function () {
|
|
119
|
+
ok(target1.hasClass('collapsed'))
|
|
120
|
+
ok(target2.hasClass('collapsed'))
|
|
121
|
+
ok(!target3.hasClass('collapsed'))
|
|
122
|
+
|
|
123
|
+
start()
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
target3.click()
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
test('should allow dots in data-parent', function () {
|
|
130
|
+
$.support.transition = false
|
|
131
|
+
stop()
|
|
132
|
+
|
|
133
|
+
var accordion = $('<div class="accordion"><div class="accordion-group"></div><div class="accordion-group"></div><div class="accordion-group"></div></div>')
|
|
134
|
+
.appendTo($('#qunit-fixture'))
|
|
135
|
+
|
|
136
|
+
var target1 = $('<a data-toggle="collapse" href="#body1" data-parent=".accordion"></a>')
|
|
137
|
+
.appendTo(accordion.find('.accordion-group').eq(0))
|
|
138
|
+
|
|
139
|
+
var collapsible1 = $('<div id="body1" class="in"></div>')
|
|
140
|
+
.appendTo(accordion.find('.accordion-group').eq(0))
|
|
141
|
+
|
|
142
|
+
var target2 = $('<a class="collapsed" data-toggle="collapse" href="#body2" data-parent=".accordion"></a>')
|
|
143
|
+
.appendTo(accordion.find('.accordion-group').eq(1))
|
|
144
|
+
|
|
145
|
+
var collapsible2 = $('<div id="body2"></div>')
|
|
146
|
+
.appendTo(accordion.find('.accordion-group').eq(1))
|
|
147
|
+
|
|
148
|
+
var target3 = $('<a class="collapsed" data-toggle="collapse" href="#body3" data-parent=".accordion"></a>')
|
|
149
|
+
.appendTo(accordion.find('.accordion-group').eq(2))
|
|
150
|
+
|
|
151
|
+
var collapsible3 = $('<div id="body3"></div>')
|
|
152
|
+
.appendTo(accordion.find('.accordion-group').eq(2))
|
|
153
|
+
.on('show.bs.collapse', function () {
|
|
154
|
+
ok(target1.hasClass('collapsed'))
|
|
155
|
+
ok(target2.hasClass('collapsed'))
|
|
156
|
+
ok(!target3.hasClass('collapsed'))
|
|
157
|
+
|
|
158
|
+
start()
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
target3.click()
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
})
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
$(function () {
|
|
2
|
+
|
|
3
|
+
module('dropdowns')
|
|
4
|
+
|
|
5
|
+
test('should provide no conflict', function () {
|
|
6
|
+
var dropdown = $.fn.dropdown.noConflict()
|
|
7
|
+
ok(!$.fn.dropdown, 'dropdown was set back to undefined (org value)')
|
|
8
|
+
$.fn.dropdown = dropdown
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('should be defined on jquery object', function () {
|
|
12
|
+
ok($(document.body).dropdown, 'dropdown method is defined')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('should return element', function () {
|
|
16
|
+
var el = $('<div />')
|
|
17
|
+
ok(el.dropdown()[0] === el[0], 'same element returned')
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('should not open dropdown if target is disabled', function () {
|
|
21
|
+
var dropdownHTML = '<ul class="tabs">' +
|
|
22
|
+
'<li class="dropdown">' +
|
|
23
|
+
'<button disabled href="#" class="btn dropdown-toggle" data-toggle="dropdown">Dropdown</button>' +
|
|
24
|
+
'<ul class="dropdown-menu">' +
|
|
25
|
+
'<li><a href="#">Secondary link</a></li>' +
|
|
26
|
+
'<li><a href="#">Something else here</a></li>' +
|
|
27
|
+
'<li class="divider"></li>' +
|
|
28
|
+
'<li><a href="#">Another link</a></li>' +
|
|
29
|
+
'</ul>' +
|
|
30
|
+
'</li>' +
|
|
31
|
+
'</ul>',
|
|
32
|
+
dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
|
|
33
|
+
|
|
34
|
+
ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
test('should not open dropdown if target is disabled', function () {
|
|
38
|
+
var dropdownHTML = '<ul class="tabs">' +
|
|
39
|
+
'<li class="dropdown">' +
|
|
40
|
+
'<button href="#" class="btn dropdown-toggle disabled" data-toggle="dropdown">Dropdown</button>' +
|
|
41
|
+
'<ul class="dropdown-menu">' +
|
|
42
|
+
'<li><a href="#">Secondary link</a></li>' +
|
|
43
|
+
'<li><a href="#">Something else here</a></li>' +
|
|
44
|
+
'<li class="divider"></li>' +
|
|
45
|
+
'<li><a href="#">Another link</a></li>' +
|
|
46
|
+
'</ul>' +
|
|
47
|
+
'</li>' +
|
|
48
|
+
'</ul>',
|
|
49
|
+
dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
|
|
50
|
+
|
|
51
|
+
ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
test('should add class open to menu if clicked', function () {
|
|
55
|
+
var dropdownHTML = '<ul class="tabs">' +
|
|
56
|
+
'<li class="dropdown">' +
|
|
57
|
+
'<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' +
|
|
58
|
+
'<ul class="dropdown-menu">' +
|
|
59
|
+
'<li><a href="#">Secondary link</a></li>' +
|
|
60
|
+
'<li><a href="#">Something else here</a></li>' +
|
|
61
|
+
'<li class="divider"></li>' +
|
|
62
|
+
'<li><a href="#">Another link</a></li>' +
|
|
63
|
+
'</ul>' +
|
|
64
|
+
'</li>' +
|
|
65
|
+
'</ul>',
|
|
66
|
+
dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
|
|
67
|
+
|
|
68
|
+
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test('should test if element has a # before assuming it\'s a selector', function () {
|
|
72
|
+
var dropdownHTML = '<ul class="tabs">' +
|
|
73
|
+
'<li class="dropdown">' +
|
|
74
|
+
'<a href="/foo/" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' +
|
|
75
|
+
'<ul class="dropdown-menu">' +
|
|
76
|
+
'<li><a href="#">Secondary link</a></li>' +
|
|
77
|
+
'<li><a href="#">Something else here</a></li>' +
|
|
78
|
+
'<li class="divider"></li>' +
|
|
79
|
+
'<li><a href="#">Another link</a></li>' +
|
|
80
|
+
'</ul>' +
|
|
81
|
+
'</li>' +
|
|
82
|
+
'</ul>',
|
|
83
|
+
dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
|
|
84
|
+
|
|
85
|
+
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
test('should remove open class if body clicked', function () {
|
|
90
|
+
var dropdownHTML = '<ul class="tabs">' +
|
|
91
|
+
'<li class="dropdown">' +
|
|
92
|
+
'<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' +
|
|
93
|
+
'<ul class="dropdown-menu">' +
|
|
94
|
+
'<li><a href="#">Secondary link</a></li>' +
|
|
95
|
+
'<li><a href="#">Something else here</a></li>' +
|
|
96
|
+
'<li class="divider"></li>' +
|
|
97
|
+
'<li><a href="#">Another link</a></li>' +
|
|
98
|
+
'</ul>' +
|
|
99
|
+
'</li>' +
|
|
100
|
+
'</ul>',
|
|
101
|
+
dropdown = $(dropdownHTML)
|
|
102
|
+
.appendTo('#qunit-fixture')
|
|
103
|
+
.find('[data-toggle="dropdown"]')
|
|
104
|
+
.dropdown()
|
|
105
|
+
.click()
|
|
106
|
+
|
|
107
|
+
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
|
|
108
|
+
$('body').click()
|
|
109
|
+
ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class removed')
|
|
110
|
+
dropdown.remove()
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
test('should remove open class if body clicked, with multiple drop downs', function () {
|
|
114
|
+
var dropdownHTML = '<ul class="nav">' +
|
|
115
|
+
' <li><a href="#menu1">Menu 1</a></li>' +
|
|
116
|
+
' <li class="dropdown" id="testmenu">' +
|
|
117
|
+
' <a class="dropdown-toggle" data-toggle="dropdown" href="#testmenu">Test menu <b class="caret"></b></a>' +
|
|
118
|
+
' <ul class="dropdown-menu" role="menu">' +
|
|
119
|
+
' <li><a href="#sub1">Submenu 1</a></li>' +
|
|
120
|
+
' </ul>' +
|
|
121
|
+
' </li>' +
|
|
122
|
+
'</ul>' +
|
|
123
|
+
'<div class="btn-group">' +
|
|
124
|
+
' <button class="btn">Actions</button>' +
|
|
125
|
+
' <button class="btn dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>' +
|
|
126
|
+
' <ul class="dropdown-menu">' +
|
|
127
|
+
' <li><a href="#">Action 1</a></li>' +
|
|
128
|
+
' </ul>' +
|
|
129
|
+
'</div>',
|
|
130
|
+
dropdowns = $(dropdownHTML).appendTo('#qunit-fixture').find('[data-toggle="dropdown"]'),
|
|
131
|
+
first = dropdowns.first(),
|
|
132
|
+
last = dropdowns.last()
|
|
133
|
+
|
|
134
|
+
ok(dropdowns.length == 2, 'Should be two dropdowns')
|
|
135
|
+
|
|
136
|
+
first.click()
|
|
137
|
+
ok(first.parents('.open').length == 1, 'open class added on click')
|
|
138
|
+
ok($('#qunit-fixture .open').length == 1, 'only one object is open')
|
|
139
|
+
$('body').click()
|
|
140
|
+
ok($('#qunit-fixture .open').length === 0, 'open class removed')
|
|
141
|
+
|
|
142
|
+
last.click()
|
|
143
|
+
ok(last.parent('.open').length == 1, 'open class added on click')
|
|
144
|
+
ok($('#qunit-fixture .open').length == 1, 'only one object is open')
|
|
145
|
+
$('body').click()
|
|
146
|
+
ok($('#qunit-fixture .open').length === 0, 'open class removed')
|
|
147
|
+
|
|
148
|
+
$('#qunit-fixture').html('')
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
test('should fire show and hide event', function () {
|
|
152
|
+
var dropdownHTML = '<ul class="tabs">' +
|
|
153
|
+
'<li class="dropdown">' +
|
|
154
|
+
'<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' +
|
|
155
|
+
'<ul class="dropdown-menu">' +
|
|
156
|
+
'<li><a href="#">Secondary link</a></li>' +
|
|
157
|
+
'<li><a href="#">Something else here</a></li>' +
|
|
158
|
+
'<li class="divider"></li>' +
|
|
159
|
+
'<li><a href="#">Another link</a></li>' +
|
|
160
|
+
'</ul>' +
|
|
161
|
+
'</li>' +
|
|
162
|
+
'</ul>',
|
|
163
|
+
dropdown = $(dropdownHTML)
|
|
164
|
+
.appendTo('#qunit-fixture')
|
|
165
|
+
.find('[data-toggle="dropdown"]')
|
|
166
|
+
.dropdown()
|
|
167
|
+
|
|
168
|
+
stop()
|
|
169
|
+
|
|
170
|
+
dropdown
|
|
171
|
+
.parent('.dropdown')
|
|
172
|
+
.bind('show.bs.dropdown', function () {
|
|
173
|
+
ok(true, 'show was called')
|
|
174
|
+
})
|
|
175
|
+
.bind('hide.bs.dropdown', function () {
|
|
176
|
+
ok(true, 'hide was called')
|
|
177
|
+
start()
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
dropdown.click()
|
|
181
|
+
$(document.body).click()
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
test('should fire shown and hiden event', function () {
|
|
186
|
+
var dropdownHTML = '<ul class="tabs">' +
|
|
187
|
+
'<li class="dropdown">' +
|
|
188
|
+
'<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' +
|
|
189
|
+
'<ul class="dropdown-menu">' +
|
|
190
|
+
'<li><a href="#">Secondary link</a></li>' +
|
|
191
|
+
'<li><a href="#">Something else here</a></li>' +
|
|
192
|
+
'<li class="divider"></li>' +
|
|
193
|
+
'<li><a href="#">Another link</a></li>' +
|
|
194
|
+
'</ul>' +
|
|
195
|
+
'</li>' +
|
|
196
|
+
'</ul>',
|
|
197
|
+
dropdown = $(dropdownHTML)
|
|
198
|
+
.appendTo('#qunit-fixture')
|
|
199
|
+
.find('[data-toggle="dropdown"]')
|
|
200
|
+
.dropdown()
|
|
201
|
+
|
|
202
|
+
stop()
|
|
203
|
+
|
|
204
|
+
dropdown
|
|
205
|
+
.parent('.dropdown')
|
|
206
|
+
.bind('shown.bs.dropdown', function () {
|
|
207
|
+
ok(true, 'show was called')
|
|
208
|
+
})
|
|
209
|
+
.bind('hidden.bs.dropdown', function () {
|
|
210
|
+
ok(true, 'hide was called')
|
|
211
|
+
start()
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
dropdown.click()
|
|
215
|
+
$(document.body).click()
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
})
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
$(function () {
|
|
2
|
+
|
|
3
|
+
module('modal')
|
|
4
|
+
|
|
5
|
+
test('should provide no conflict', function () {
|
|
6
|
+
var modal = $.fn.modal.noConflict()
|
|
7
|
+
ok(!$.fn.modal, 'modal was set back to undefined (org value)')
|
|
8
|
+
$.fn.modal = modal
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('should be defined on jquery object', function () {
|
|
12
|
+
var div = $('<div id="modal-test"></div>')
|
|
13
|
+
ok(div.modal, 'modal method is defined')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test('should return element', function () {
|
|
17
|
+
var div = $('<div id="modal-test"></div>')
|
|
18
|
+
ok(div.modal() == div, 'document.body returned')
|
|
19
|
+
$('#modal-test').remove()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('should expose defaults var for settings', function () {
|
|
23
|
+
ok($.fn.modal.Constructor.DEFAULTS, 'default object exposed')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
test('should insert into dom when show method is called', function () {
|
|
27
|
+
stop()
|
|
28
|
+
$.support.transition = false
|
|
29
|
+
$('<div id="modal-test"></div>')
|
|
30
|
+
.on('shown.bs.modal', function () {
|
|
31
|
+
ok($('#modal-test').length, 'modal inserted into dom')
|
|
32
|
+
$(this).remove()
|
|
33
|
+
start()
|
|
34
|
+
})
|
|
35
|
+
.modal('show')
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('should fire show event', function () {
|
|
39
|
+
stop()
|
|
40
|
+
$.support.transition = false
|
|
41
|
+
$('<div id="modal-test"></div>')
|
|
42
|
+
.on('show.bs.modal', function () {
|
|
43
|
+
ok(true, 'show was called')
|
|
44
|
+
})
|
|
45
|
+
.on('shown.bs.modal', function () {
|
|
46
|
+
$(this).remove()
|
|
47
|
+
start()
|
|
48
|
+
})
|
|
49
|
+
.modal('show')
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test('should not fire shown when default prevented', function () {
|
|
53
|
+
stop()
|
|
54
|
+
$.support.transition = false
|
|
55
|
+
$('<div id="modal-test"></div>')
|
|
56
|
+
.on('show.bs.modal', function (e) {
|
|
57
|
+
e.preventDefault()
|
|
58
|
+
ok(true, 'show was called')
|
|
59
|
+
start()
|
|
60
|
+
})
|
|
61
|
+
.on('shown.bs.modal', function () {
|
|
62
|
+
ok(false, 'shown was called')
|
|
63
|
+
})
|
|
64
|
+
.modal('show')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('should hide modal when hide is called', function () {
|
|
68
|
+
stop()
|
|
69
|
+
$.support.transition = false
|
|
70
|
+
|
|
71
|
+
$('<div id="modal-test"></div>')
|
|
72
|
+
.on('shown.bs.modal', function () {
|
|
73
|
+
ok($('#modal-test').is(':visible'), 'modal visible')
|
|
74
|
+
ok($('#modal-test').length, 'modal inserted into dom')
|
|
75
|
+
$(this).modal('hide')
|
|
76
|
+
})
|
|
77
|
+
.on('hidden.bs.modal', function () {
|
|
78
|
+
ok(!$('#modal-test').is(':visible'), 'modal hidden')
|
|
79
|
+
$('#modal-test').remove()
|
|
80
|
+
start()
|
|
81
|
+
})
|
|
82
|
+
.modal('show')
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('should toggle when toggle is called', function () {
|
|
86
|
+
stop()
|
|
87
|
+
$.support.transition = false
|
|
88
|
+
var div = $('<div id="modal-test"></div>')
|
|
89
|
+
div
|
|
90
|
+
.on('shown.bs.modal', function () {
|
|
91
|
+
ok($('#modal-test').is(':visible'), 'modal visible')
|
|
92
|
+
ok($('#modal-test').length, 'modal inserted into dom')
|
|
93
|
+
div.modal('toggle')
|
|
94
|
+
})
|
|
95
|
+
.on('hidden.bs.modal', function () {
|
|
96
|
+
ok(!$('#modal-test').is(':visible'), 'modal hidden')
|
|
97
|
+
div.remove()
|
|
98
|
+
start()
|
|
99
|
+
})
|
|
100
|
+
.modal('toggle')
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('should remove from dom when click [data-dismiss=modal]', function () {
|
|
104
|
+
stop()
|
|
105
|
+
$.support.transition = false
|
|
106
|
+
var div = $('<div id="modal-test"><span class="close" data-dismiss="modal"></span></div>')
|
|
107
|
+
div
|
|
108
|
+
.on('shown.bs.modal', function () {
|
|
109
|
+
ok($('#modal-test').is(':visible'), 'modal visible')
|
|
110
|
+
ok($('#modal-test').length, 'modal inserted into dom')
|
|
111
|
+
div.find('.close').click()
|
|
112
|
+
})
|
|
113
|
+
.on('hidden.bs.modal', function () {
|
|
114
|
+
ok(!$('#modal-test').is(':visible'), 'modal hidden')
|
|
115
|
+
div.remove()
|
|
116
|
+
start()
|
|
117
|
+
})
|
|
118
|
+
.modal('toggle')
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
test('should allow modal close with "backdrop:false"', function () {
|
|
122
|
+
stop()
|
|
123
|
+
$.support.transition = false
|
|
124
|
+
var div = $('<div>', { id: 'modal-test', 'data-backdrop': false })
|
|
125
|
+
div
|
|
126
|
+
.on('shown.bs.modal', function () {
|
|
127
|
+
ok($('#modal-test').is(':visible'), 'modal visible')
|
|
128
|
+
div.modal('hide')
|
|
129
|
+
})
|
|
130
|
+
.on('hidden.bs.modal', function () {
|
|
131
|
+
ok(!$('#modal-test').is(':visible'), 'modal hidden')
|
|
132
|
+
div.remove()
|
|
133
|
+
start()
|
|
134
|
+
})
|
|
135
|
+
.modal('show')
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
test('should close modal when clicking outside of modal-content', function () {
|
|
139
|
+
stop()
|
|
140
|
+
$.support.transition = false
|
|
141
|
+
var div = $('<div id="modal-test"><div class="contents"></div></div>')
|
|
142
|
+
div
|
|
143
|
+
.bind('shown.bs.modal', function () {
|
|
144
|
+
ok($('#modal-test').length, 'modal insterted into dom')
|
|
145
|
+
$('.contents').click()
|
|
146
|
+
ok($('#modal-test').is(':visible'), 'modal visible')
|
|
147
|
+
$('#modal-test').click()
|
|
148
|
+
})
|
|
149
|
+
.bind('hidden.bs.modal', function () {
|
|
150
|
+
ok(!$('#modal-test').is(':visible'), 'modal hidden')
|
|
151
|
+
div.remove()
|
|
152
|
+
start()
|
|
153
|
+
})
|
|
154
|
+
.modal('show')
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
test('should trigger hide event once when clicking outside of modal-content', function () {
|
|
158
|
+
stop()
|
|
159
|
+
$.support.transition = false
|
|
160
|
+
|
|
161
|
+
var triggered
|
|
162
|
+
var div = $('<div id="modal-test"><div class="contents"></div></div>')
|
|
163
|
+
|
|
164
|
+
div
|
|
165
|
+
.bind('shown.bs.modal', function () {
|
|
166
|
+
triggered = 0
|
|
167
|
+
$('#modal-test').click()
|
|
168
|
+
})
|
|
169
|
+
.bind('hide.bs.modal', function () {
|
|
170
|
+
triggered += 1
|
|
171
|
+
ok(triggered === 1, 'modal hide triggered once')
|
|
172
|
+
start()
|
|
173
|
+
})
|
|
174
|
+
.modal('show')
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
test('should close reopened modal with [data-dismiss=modal] click', function () {
|
|
178
|
+
stop()
|
|
179
|
+
$.support.transition = false
|
|
180
|
+
var div = $('<div id="modal-test"><div class="contents"><div id="close" data-dismiss="modal"></div></div></div>')
|
|
181
|
+
div
|
|
182
|
+
.bind('shown.bs.modal', function () {
|
|
183
|
+
$('#close').click()
|
|
184
|
+
ok(!$('#modal-test').is(':visible'), 'modal hidden')
|
|
185
|
+
})
|
|
186
|
+
.one('hidden.bs.modal', function () {
|
|
187
|
+
div.one('hidden.bs.modal', function () {
|
|
188
|
+
start()
|
|
189
|
+
}).modal('show')
|
|
190
|
+
})
|
|
191
|
+
.modal('show')
|
|
192
|
+
|
|
193
|
+
div.remove()
|
|
194
|
+
})
|
|
195
|
+
})
|