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
data/public/js/tab.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/* ========================================================================
|
|
2
|
+
* Bootstrap: tab.js v3.1.0
|
|
3
|
+
* http://getbootstrap.com/javascript/#tabs
|
|
4
|
+
* ========================================================================
|
|
5
|
+
* Copyright 2011-2014 Twitter, Inc.
|
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
7
|
+
* ======================================================================== */
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
+function ($) {
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
// TAB CLASS DEFINITION
|
|
14
|
+
// ====================
|
|
15
|
+
|
|
16
|
+
var Tab = function (element) {
|
|
17
|
+
this.element = $(element)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Tab.prototype.show = function () {
|
|
21
|
+
var $this = this.element
|
|
22
|
+
var $ul = $this.closest('ul:not(.dropdown-menu)')
|
|
23
|
+
var selector = $this.data('target')
|
|
24
|
+
|
|
25
|
+
if (!selector) {
|
|
26
|
+
selector = $this.attr('href')
|
|
27
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if ($this.parent('li').hasClass('active')) return
|
|
31
|
+
|
|
32
|
+
var previous = $ul.find('.active:last a')[0]
|
|
33
|
+
var e = $.Event('show.bs.tab', {
|
|
34
|
+
relatedTarget: previous
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
$this.trigger(e)
|
|
38
|
+
|
|
39
|
+
if (e.isDefaultPrevented()) return
|
|
40
|
+
|
|
41
|
+
var $target = $(selector)
|
|
42
|
+
|
|
43
|
+
this.activate($this.parent('li'), $ul)
|
|
44
|
+
this.activate($target, $target.parent(), function () {
|
|
45
|
+
$this.trigger({
|
|
46
|
+
type: 'shown.bs.tab',
|
|
47
|
+
relatedTarget: previous
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Tab.prototype.activate = function (element, container, callback) {
|
|
53
|
+
var $active = container.find('> .active')
|
|
54
|
+
var transition = callback
|
|
55
|
+
&& $.support.transition
|
|
56
|
+
&& $active.hasClass('fade')
|
|
57
|
+
|
|
58
|
+
function next() {
|
|
59
|
+
$active
|
|
60
|
+
.removeClass('active')
|
|
61
|
+
.find('> .dropdown-menu > .active')
|
|
62
|
+
.removeClass('active')
|
|
63
|
+
|
|
64
|
+
element.addClass('active')
|
|
65
|
+
|
|
66
|
+
if (transition) {
|
|
67
|
+
element[0].offsetWidth // reflow for transition
|
|
68
|
+
element.addClass('in')
|
|
69
|
+
} else {
|
|
70
|
+
element.removeClass('fade')
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (element.parent('.dropdown-menu')) {
|
|
74
|
+
element.closest('li.dropdown').addClass('active')
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
callback && callback()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
transition ?
|
|
81
|
+
$active
|
|
82
|
+
.one($.support.transition.end, next)
|
|
83
|
+
.emulateTransitionEnd(150) :
|
|
84
|
+
next()
|
|
85
|
+
|
|
86
|
+
$active.removeClass('in')
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// TAB PLUGIN DEFINITION
|
|
91
|
+
// =====================
|
|
92
|
+
|
|
93
|
+
var old = $.fn.tab
|
|
94
|
+
|
|
95
|
+
$.fn.tab = function ( option ) {
|
|
96
|
+
return this.each(function () {
|
|
97
|
+
var $this = $(this)
|
|
98
|
+
var data = $this.data('bs.tab')
|
|
99
|
+
|
|
100
|
+
if (!data) $this.data('bs.tab', (data = new Tab(this)))
|
|
101
|
+
if (typeof option == 'string') data[option]()
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
$.fn.tab.Constructor = Tab
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
// TAB NO CONFLICT
|
|
109
|
+
// ===============
|
|
110
|
+
|
|
111
|
+
$.fn.tab.noConflict = function () {
|
|
112
|
+
$.fn.tab = old
|
|
113
|
+
return this
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
// TAB DATA-API
|
|
118
|
+
// ============
|
|
119
|
+
|
|
120
|
+
$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
|
121
|
+
e.preventDefault()
|
|
122
|
+
$(this).tab('show')
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
}(jQuery);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!DOCTYPE HTML>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Bootstrap Plugin Test Suite</title>
|
|
5
|
+
|
|
6
|
+
<!-- jquery -->
|
|
7
|
+
<script src="vendor/jquery.js"></script>
|
|
8
|
+
|
|
9
|
+
<!-- qunit -->
|
|
10
|
+
<link rel="stylesheet" href="vendor/qunit.css" media="screen">
|
|
11
|
+
<script src="vendor/qunit.js"></script>
|
|
12
|
+
<script>
|
|
13
|
+
// See https://github.com/axemclion/grunt-saucelabs#test-result-details-with-qunit
|
|
14
|
+
QUnit.done(function(results) {
|
|
15
|
+
window.global_test_results = results
|
|
16
|
+
})
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<!-- plugin sources -->
|
|
20
|
+
<script>$.support.transition = false</script>
|
|
21
|
+
<script src="../../js/alert.js"></script>
|
|
22
|
+
<script src="../../js/button.js"></script>
|
|
23
|
+
<script src="../../js/carousel.js"></script>
|
|
24
|
+
<script src="../../js/collapse.js"></script>
|
|
25
|
+
<script src="../../js/dropdown.js"></script>
|
|
26
|
+
<script src="../../js/modal.js"></script>
|
|
27
|
+
<script src="../../js/scrollspy.js"></script>
|
|
28
|
+
<script src="../../js/tab.js"></script>
|
|
29
|
+
<script src="../../js/tooltip.js"></script>
|
|
30
|
+
<script src="../../js/popover.js"></script>
|
|
31
|
+
<script src="../../js/affix.js"></script>
|
|
32
|
+
|
|
33
|
+
<!-- unit tests -->
|
|
34
|
+
<script src="unit/transition.js"></script>
|
|
35
|
+
<script src="unit/alert.js"></script>
|
|
36
|
+
<script src="unit/button.js"></script>
|
|
37
|
+
<script src="unit/carousel.js"></script>
|
|
38
|
+
<script src="unit/collapse.js"></script>
|
|
39
|
+
<script src="unit/dropdown.js"></script>
|
|
40
|
+
<script src="unit/modal.js"></script>
|
|
41
|
+
<script src="unit/scrollspy.js"></script>
|
|
42
|
+
<script src="unit/tab.js"></script>
|
|
43
|
+
<script src="unit/tooltip.js"></script>
|
|
44
|
+
<script src="unit/popover.js"></script>
|
|
45
|
+
<script src="unit/affix.js"></script>
|
|
46
|
+
|
|
47
|
+
</head>
|
|
48
|
+
<body>
|
|
49
|
+
<div>
|
|
50
|
+
<div id="qunit"></div>
|
|
51
|
+
<div id="qunit-fixture"></div>
|
|
52
|
+
</div>
|
|
53
|
+
</body>
|
|
54
|
+
</html>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
$(function () {
|
|
2
|
+
|
|
3
|
+
module('affix')
|
|
4
|
+
|
|
5
|
+
test('should provide no conflict', function () {
|
|
6
|
+
var affix = $.fn.affix.noConflict()
|
|
7
|
+
ok(!$.fn.affix, 'affix was set back to undefined (org value)')
|
|
8
|
+
$.fn.affix = affix
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('should be defined on jquery object', function () {
|
|
12
|
+
ok($(document.body).affix, 'affix method is defined')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('should return element', function () {
|
|
16
|
+
ok($(document.body).affix()[0] == document.body, 'document.body returned')
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
test('should exit early if element is not visible', function () {
|
|
20
|
+
var $affix = $('<div style="display: none"></div>').affix()
|
|
21
|
+
$affix.data('bs.affix').checkPosition()
|
|
22
|
+
ok(!$affix.hasClass('affix'), 'affix class was not added')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('should trigger affixed event after affix', function () {
|
|
26
|
+
stop()
|
|
27
|
+
|
|
28
|
+
var template = $('<div id="affixTarget"><ul><li>Please affix</li><li>And unaffix</li></ul></div><div id="affixAfter" style="height: 20000px; display:block;"></div>')
|
|
29
|
+
template.appendTo('body')
|
|
30
|
+
|
|
31
|
+
var affixer = $('#affixTarget').affix({
|
|
32
|
+
offset: $('#affixTarget ul').position()
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
$('#affixTarget')
|
|
36
|
+
.on('affix.bs.affix', function (e) {
|
|
37
|
+
ok(true, 'affix event triggered')
|
|
38
|
+
}).on('affixed.bs.affix', function (e) {
|
|
39
|
+
ok(true,'affixed event triggered')
|
|
40
|
+
$('#affixTarget').remove()
|
|
41
|
+
$('#affixAfter').remove()
|
|
42
|
+
start()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
setTimeout(function () {
|
|
46
|
+
window.scrollTo(0, document.body.scrollHeight)
|
|
47
|
+
setTimeout(function () { window.scroll(0,0) }, 0)
|
|
48
|
+
},0)
|
|
49
|
+
})
|
|
50
|
+
})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
$(function () {
|
|
2
|
+
|
|
3
|
+
module('alert')
|
|
4
|
+
|
|
5
|
+
test('should provide no conflict', function () {
|
|
6
|
+
var alert = $.fn.alert.noConflict()
|
|
7
|
+
ok(!$.fn.alert, 'alert was set back to undefined (org value)')
|
|
8
|
+
$.fn.alert = alert
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('should be defined on jquery object', function () {
|
|
12
|
+
ok($(document.body).alert, 'alert method is defined')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('should return element', function () {
|
|
16
|
+
ok($(document.body).alert()[0] == document.body, 'document.body returned')
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
test('should fade element out on clicking .close', function () {
|
|
20
|
+
var alertHTML = '<div class="alert-message warning fade in">' +
|
|
21
|
+
'<a class="close" href="#" data-dismiss="alert">×</a>' +
|
|
22
|
+
'<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>' +
|
|
23
|
+
'</div>',
|
|
24
|
+
alert = $(alertHTML).alert()
|
|
25
|
+
|
|
26
|
+
alert.find('.close').click()
|
|
27
|
+
|
|
28
|
+
ok(!alert.hasClass('in'), 'remove .in class on .close click')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('should remove element when clicking .close', function () {
|
|
32
|
+
$.support.transition = false
|
|
33
|
+
|
|
34
|
+
var alertHTML = '<div class="alert-message warning fade in">' +
|
|
35
|
+
'<a class="close" href="#" data-dismiss="alert">×</a>' +
|
|
36
|
+
'<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>' +
|
|
37
|
+
'</div>',
|
|
38
|
+
alert = $(alertHTML).appendTo('#qunit-fixture').alert()
|
|
39
|
+
|
|
40
|
+
ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom')
|
|
41
|
+
|
|
42
|
+
alert.find('.close').click()
|
|
43
|
+
|
|
44
|
+
ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('should not fire closed when close is prevented', function () {
|
|
48
|
+
$.support.transition = false
|
|
49
|
+
stop();
|
|
50
|
+
$('<div class="alert"/>')
|
|
51
|
+
.on('close.bs.alert', function (e) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
ok(true);
|
|
54
|
+
start();
|
|
55
|
+
})
|
|
56
|
+
.on('closed.bs.alert', function () {
|
|
57
|
+
ok(false);
|
|
58
|
+
})
|
|
59
|
+
.alert('close')
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
})
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
$(function () {
|
|
2
|
+
|
|
3
|
+
module('button')
|
|
4
|
+
|
|
5
|
+
test('should provide no conflict', function () {
|
|
6
|
+
var button = $.fn.button.noConflict()
|
|
7
|
+
ok(!$.fn.button, 'button was set back to undefined (org value)')
|
|
8
|
+
$.fn.button = button
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('should be defined on jquery object', function () {
|
|
12
|
+
ok($(document.body).button, 'button method is defined')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('should return element', function () {
|
|
16
|
+
ok($(document.body).button()[0] == document.body, 'document.body returned')
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
test('should return set state to loading', function () {
|
|
20
|
+
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
|
21
|
+
equal(btn.html(), 'mdo', 'btn text equals mdo')
|
|
22
|
+
btn.button('loading')
|
|
23
|
+
equal(btn.html(), 'fat', 'btn text equals fat')
|
|
24
|
+
stop()
|
|
25
|
+
setTimeout(function () {
|
|
26
|
+
ok(btn.attr('disabled'), 'btn is disabled')
|
|
27
|
+
ok(btn.hasClass('disabled'), 'btn has disabled class')
|
|
28
|
+
start()
|
|
29
|
+
}, 0)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
test('should return reset state', function () {
|
|
33
|
+
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
|
34
|
+
equal(btn.html(), 'mdo', 'btn text equals mdo')
|
|
35
|
+
btn.button('loading')
|
|
36
|
+
equal(btn.html(), 'fat', 'btn text equals fat')
|
|
37
|
+
stop()
|
|
38
|
+
setTimeout(function () {
|
|
39
|
+
ok(btn.attr('disabled'), 'btn is disabled')
|
|
40
|
+
ok(btn.hasClass('disabled'), 'btn has disabled class')
|
|
41
|
+
start()
|
|
42
|
+
stop()
|
|
43
|
+
btn.button('reset')
|
|
44
|
+
equal(btn.html(), 'mdo', 'btn text equals mdo')
|
|
45
|
+
setTimeout(function () {
|
|
46
|
+
ok(!btn.attr('disabled'), 'btn is not disabled')
|
|
47
|
+
ok(!btn.hasClass('disabled'), 'btn does not have disabled class')
|
|
48
|
+
start()
|
|
49
|
+
}, 0)
|
|
50
|
+
}, 0)
|
|
51
|
+
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
test('should toggle active', function () {
|
|
55
|
+
var btn = $('<button class="btn">mdo</button>')
|
|
56
|
+
ok(!btn.hasClass('active'), 'btn does not have active class')
|
|
57
|
+
btn.button('toggle')
|
|
58
|
+
ok(btn.hasClass('active'), 'btn has class active')
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
test('should toggle active when btn children are clicked', function () {
|
|
62
|
+
var btn = $('<button class="btn" data-toggle="button">mdo</button>'),
|
|
63
|
+
inner = $('<i></i>')
|
|
64
|
+
btn
|
|
65
|
+
.append(inner)
|
|
66
|
+
.appendTo($('#qunit-fixture'))
|
|
67
|
+
ok(!btn.hasClass('active'), 'btn does not have active class')
|
|
68
|
+
inner.click()
|
|
69
|
+
ok(btn.hasClass('active'), 'btn has class active')
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
test('should toggle active when btn children are clicked within btn-group', function () {
|
|
73
|
+
var btngroup = $('<div class="btn-group" data-toggle="buttons"></div>'),
|
|
74
|
+
btn = $('<button class="btn">fat</button>'),
|
|
75
|
+
inner = $('<i></i>')
|
|
76
|
+
btngroup
|
|
77
|
+
.append(btn.append(inner))
|
|
78
|
+
.appendTo($('#qunit-fixture'))
|
|
79
|
+
ok(!btn.hasClass('active'), 'btn does not have active class')
|
|
80
|
+
inner.click()
|
|
81
|
+
ok(btn.hasClass('active'), 'btn has class active')
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
test('should check for closest matching toggle', function () {
|
|
85
|
+
var group = '<div class="btn-group" data-toggle="buttons">' +
|
|
86
|
+
'<label class="btn btn-primary active">' +
|
|
87
|
+
'<input type="radio" name="options" id="option1" checked="true"> Option 1' +
|
|
88
|
+
'</label>' +
|
|
89
|
+
'<label class="btn btn-primary">' +
|
|
90
|
+
'<input type="radio" name="options" id="option2"> Option 2' +
|
|
91
|
+
'</label>' +
|
|
92
|
+
'<label class="btn btn-primary">' +
|
|
93
|
+
'<input type="radio" name="options" id="option3"> Option 3' +
|
|
94
|
+
'</label>' +
|
|
95
|
+
'</div>'
|
|
96
|
+
|
|
97
|
+
group = $(group)
|
|
98
|
+
|
|
99
|
+
var btn1 = $(group.children()[0])
|
|
100
|
+
var btn2 = $(group.children()[1])
|
|
101
|
+
var btn3 = $(group.children()[2])
|
|
102
|
+
|
|
103
|
+
group.appendTo($('#qunit-fixture'))
|
|
104
|
+
|
|
105
|
+
ok(btn1.hasClass('active'), 'btn1 has active class')
|
|
106
|
+
ok(btn1.find('input').prop('checked'), 'btn1 is checked')
|
|
107
|
+
ok(!btn2.hasClass('active'), 'btn2 does not have active class')
|
|
108
|
+
ok(!btn2.find('input').prop('checked'), 'btn2 is not checked')
|
|
109
|
+
btn2.find('input').click()
|
|
110
|
+
ok(!btn1.hasClass('active'), 'btn1 does not have active class')
|
|
111
|
+
ok(!btn1.find('input').prop('checked'), 'btn1 is checked')
|
|
112
|
+
ok(btn2.hasClass('active'), 'btn2 has active class')
|
|
113
|
+
ok(btn2.find('input').prop('checked'), 'btn2 is checked')
|
|
114
|
+
|
|
115
|
+
btn2.find('input').click() /* clicking an already checked radio should not un-check it */
|
|
116
|
+
ok(!btn1.hasClass('active'), 'btn1 does not have active class')
|
|
117
|
+
ok(!btn1.find('input').prop('checked'), 'btn1 is checked')
|
|
118
|
+
ok(btn2.hasClass('active'), 'btn2 has active class')
|
|
119
|
+
ok(btn2.find('input').prop('checked'), 'btn2 is checked')
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
})
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
$(function () {
|
|
2
|
+
|
|
3
|
+
module('carousel')
|
|
4
|
+
|
|
5
|
+
test('should provide no conflict', function () {
|
|
6
|
+
var carousel = $.fn.carousel.noConflict()
|
|
7
|
+
ok(!$.fn.carousel, 'carousel was set back to undefined (org value)')
|
|
8
|
+
$.fn.carousel = carousel
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('should be defined on jquery object', function () {
|
|
12
|
+
ok($(document.body).carousel, 'carousel method is defined')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('should return element', function () {
|
|
16
|
+
ok($(document.body).carousel()[0] == document.body, 'document.body returned')
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
test('should not fire slide when slide is prevented', function () {
|
|
20
|
+
$.support.transition = false
|
|
21
|
+
stop()
|
|
22
|
+
$('<div class="carousel"/>')
|
|
23
|
+
.on('slide.bs.carousel', function (e) {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
ok(true);
|
|
26
|
+
start();
|
|
27
|
+
})
|
|
28
|
+
.on('slid.bs.carousel', function () {
|
|
29
|
+
ok(false);
|
|
30
|
+
})
|
|
31
|
+
.carousel('next')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('should reset when slide is prevented', function () {
|
|
35
|
+
var template = '<div id="carousel-example-generic" class="carousel slide"><ol class="carousel-indicators"><li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li><li data-target="#carousel-example-generic" data-slide-to="1"></li><li data-target="#carousel-example-generic" data-slide-to="2"></li></ol><div class="carousel-inner"><div class="item active"><div class="carousel-caption"></div></div><div class="item"><div class="carousel-caption"></div></div><div class="item"><div class="carousel-caption"></div></div></div><a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"></a><a class="right carousel-control" href="#carousel-example-generic" data-slide="next"></a></div>'
|
|
36
|
+
var $carousel = $(template)
|
|
37
|
+
$.support.transition = false
|
|
38
|
+
stop()
|
|
39
|
+
$carousel.one('slide.bs.carousel', function (e) {
|
|
40
|
+
e.preventDefault()
|
|
41
|
+
setTimeout(function () {
|
|
42
|
+
ok($carousel.find('.item:eq(0)').is('.active'))
|
|
43
|
+
ok($carousel.find('.carousel-indicators li:eq(0)').is('.active'))
|
|
44
|
+
$carousel.carousel('next')
|
|
45
|
+
}, 1);
|
|
46
|
+
})
|
|
47
|
+
$carousel.one('slid.bs.carousel', function () {
|
|
48
|
+
setTimeout(function () {
|
|
49
|
+
ok($carousel.find('.item:eq(1)').is('.active'))
|
|
50
|
+
ok($carousel.find('.carousel-indicators li:eq(1)').is('.active'))
|
|
51
|
+
start()
|
|
52
|
+
}, 1);
|
|
53
|
+
})
|
|
54
|
+
$carousel.carousel('next')
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
test('should fire slide event with direction', function () {
|
|
58
|
+
var template = '<div id="myCarousel" class="carousel slide"><div class="carousel-inner"><div class="item active"><img alt=""><div class="carousel-caption"><h4>{{_i}}First Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Second Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Third Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div></div><a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a><a class="right carousel-control" href="#myCarousel" data-slide="next">›</a></div>'
|
|
59
|
+
$.support.transition = false
|
|
60
|
+
stop()
|
|
61
|
+
$(template).on('slide.bs.carousel', function (e) {
|
|
62
|
+
e.preventDefault()
|
|
63
|
+
ok(e.direction)
|
|
64
|
+
ok(e.direction === 'right' || e.direction === 'left')
|
|
65
|
+
start()
|
|
66
|
+
}).carousel('next')
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('should fire slide event with relatedTarget', function () {
|
|
70
|
+
var template = '<div id="myCarousel" class="carousel slide"><div class="carousel-inner"><div class="item active"><img alt=""><div class="carousel-caption"><h4>{{_i}}First Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Second Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Third Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div></div><a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a><a class="right carousel-control" href="#myCarousel" data-slide="next">›</a></div>'
|
|
71
|
+
$.support.transition = false
|
|
72
|
+
stop()
|
|
73
|
+
$(template)
|
|
74
|
+
.on('slide.bs.carousel', function (e) {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
ok(e.relatedTarget);
|
|
77
|
+
ok($(e.relatedTarget).hasClass('item'));
|
|
78
|
+
start();
|
|
79
|
+
})
|
|
80
|
+
.carousel('next')
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
test('should set interval from data attribute', 4, function () {
|
|
84
|
+
var template = $('<div id="myCarousel" class="carousel slide"> <div class="carousel-inner"> <div class="item active"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}First Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Second Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Third Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">›</a> </div>');
|
|
85
|
+
template.attr('data-interval', 1814);
|
|
86
|
+
|
|
87
|
+
template.appendTo('body');
|
|
88
|
+
$('[data-slide]').first().click();
|
|
89
|
+
ok($('#myCarousel').data('bs.carousel').options.interval == 1814);
|
|
90
|
+
$('#myCarousel').remove();
|
|
91
|
+
|
|
92
|
+
template.appendTo('body').attr('data-modal', 'foobar');
|
|
93
|
+
$('[data-slide]').first().click();
|
|
94
|
+
ok($('#myCarousel').data('bs.carousel').options.interval == 1814, 'even if there is an data-modal attribute set');
|
|
95
|
+
$('#myCarousel').remove();
|
|
96
|
+
|
|
97
|
+
template.appendTo('body');
|
|
98
|
+
$('[data-slide]').first().click();
|
|
99
|
+
$('#myCarousel').attr('data-interval', 1860);
|
|
100
|
+
$('[data-slide]').first().click();
|
|
101
|
+
ok($('#myCarousel').data('bs.carousel').options.interval == 1814, 'attributes should be read only on intitialization');
|
|
102
|
+
$('#myCarousel').remove();
|
|
103
|
+
|
|
104
|
+
template.attr('data-interval', false);
|
|
105
|
+
template.appendTo('body');
|
|
106
|
+
$('#myCarousel').carousel(1);
|
|
107
|
+
ok($('#myCarousel').data('bs.carousel').options.interval === false, 'data attribute has higher priority than default options');
|
|
108
|
+
$('#myCarousel').remove();
|
|
109
|
+
})
|
|
110
|
+
})
|