Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorfat <jacobthornton@gmail.com>2013-05-16 22:06:30 +0400
committerfat <jacobthornton@gmail.com>2013-05-16 22:06:30 +0400
commit14651035deda4d02a1ca02c6088c34f770f897f6 (patch)
tree34002a1d364bb2618ab2526d5f0f9bd5c823bf47 /js/tests
parent509f2244da757a60d3548a7d34d63080dc01ee19 (diff)
a bunch javascript junk
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/index.html52
-rw-r--r--js/tests/unit/affix.js (renamed from js/tests/unit/bootstrap-affix.js)4
-rw-r--r--js/tests/unit/alert.js (renamed from js/tests/unit/bootstrap-alert.js)6
-rw-r--r--js/tests/unit/bootstrap-typeahead.js236
-rw-r--r--js/tests/unit/button.js (renamed from js/tests/unit/bootstrap-button.js)2
-rw-r--r--js/tests/unit/carousel.js (renamed from js/tests/unit/bootstrap-carousel.js)2
-rw-r--r--js/tests/unit/collapse.js (renamed from js/tests/unit/bootstrap-collapse.js)2
-rw-r--r--js/tests/unit/dropdown.js (renamed from js/tests/unit/bootstrap-dropdown.js)2
-rw-r--r--js/tests/unit/modal.js (renamed from js/tests/unit/bootstrap-modal.js)2
-rw-r--r--js/tests/unit/phantom.js (renamed from js/tests/unit/bootstrap-phantom.js)0
-rw-r--r--js/tests/unit/popover.js (renamed from js/tests/unit/bootstrap-popover.js)2
-rw-r--r--js/tests/unit/scrollspy.js (renamed from js/tests/unit/bootstrap-scrollspy.js)2
-rw-r--r--js/tests/unit/tab.js (renamed from js/tests/unit/bootstrap-tab.js)2
-rw-r--r--js/tests/unit/tooltip.js (renamed from js/tests/unit/bootstrap-tooltip.js)2
-rw-r--r--js/tests/unit/transition.js (renamed from js/tests/unit/bootstrap-transition.js)2
15 files changed, 40 insertions, 278 deletions
diff --git a/js/tests/index.html b/js/tests/index.html
index 887ac4deb6..322a8efd37 100644
--- a/js/tests/index.html
+++ b/js/tests/index.html
@@ -12,37 +12,35 @@
<script src="vendor/qunit.js"></script>
<!-- phantomjs logging script-->
- <script src="unit/bootstrap-phantom.js"></script>
+ <script src="unit/phantom.js"></script>
<!-- plugin sources -->
- <script src="../../js/bootstrap-transition.js"></script>
- <script src="../../js/bootstrap-alert.js"></script>
- <script src="../../js/bootstrap-button.js"></script>
- <script src="../../js/bootstrap-carousel.js"></script>
- <script src="../../js/bootstrap-collapse.js"></script>
- <script src="../../js/bootstrap-dropdown.js"></script>
- <script src="../../js/bootstrap-modal.js"></script>
- <script src="../../js/bootstrap-scrollspy.js"></script>
- <script src="../../js/bootstrap-tab.js"></script>
- <script src="../../js/bootstrap-tooltip.js"></script>
- <script src="../../js/bootstrap-popover.js"></script>
- <script src="../../js/bootstrap-typeahead.js"></script>
- <script src="../../js/bootstrap-affix.js"></script>
+ <script src="../../js/transition.js"></script>
+ <script src="../../js/alert.js"></script>
+ <script src="../../js/button.js"></script>
+ <script src="../../js/carousel.js"></script>
+ <script src="../../js/collapse.js"></script>
+ <script src="../../js/dropdown.js"></script>
+ <script src="../../js/modal.js"></script>
+ <script src="../../js/scrollspy.js"></script>
+ <script src="../../js/tab.js"></script>
+ <script src="../../js/tooltip.js"></script>
+ <script src="../../js/popover.js"></script>
+ <script src="../../js/affix.js"></script>
<!-- unit tests -->
- <script src="unit/bootstrap-transition.js"></script>
- <script src="unit/bootstrap-alert.js"></script>
- <script src="unit/bootstrap-button.js"></script>
- <script src="unit/bootstrap-carousel.js"></script>
- <script src="unit/bootstrap-collapse.js"></script>
- <script src="unit/bootstrap-dropdown.js"></script>
- <script src="unit/bootstrap-modal.js"></script>
- <script src="unit/bootstrap-scrollspy.js"></script>
- <script src="unit/bootstrap-tab.js"></script>
- <script src="unit/bootstrap-tooltip.js"></script>
- <script src="unit/bootstrap-popover.js"></script>
- <script src="unit/bootstrap-typeahead.js"></script>
- <script src="unit/bootstrap-affix.js"></script>
+ <script src="unit/transition.js"></script>
+ <script src="unit/alert.js"></script>
+ <script src="unit/button.js"></script>
+ <script src="unit/carousel.js"></script>
+ <script src="unit/collapse.js"></script>
+ <script src="unit/dropdown.js"></script>
+ <script src="unit/modal.js"></script>
+ <script src="unit/scrollspy.js"></script>
+ <script src="unit/tab.js"></script>
+ <script src="unit/tooltip.js"></script>
+ <script src="unit/popover.js"></script>
+ <script src="unit/affix.js"></script>
</head>
<body>
<div>
diff --git a/js/tests/unit/bootstrap-affix.js b/js/tests/unit/affix.js
index 2ade73b456..9829b05ad9 100644
--- a/js/tests/unit/bootstrap-affix.js
+++ b/js/tests/unit/affix.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-affix")
+ module("affix")
test("should provide no conflict", function () {
var affix = $.fn.affix.noConflict()
@@ -18,7 +18,7 @@ $(function () {
test("should exit early if element is not visible", function () {
var $affix = $('<div style="display: none"></div>').affix()
- $affix.data('affix').checkPosition()
+ $affix.data('bs-affix').checkPosition()
ok(!$affix.hasClass('affix'), 'affix class was not added')
})
diff --git a/js/tests/unit/bootstrap-alert.js b/js/tests/unit/alert.js
index dd2dfb9987..03993d07f8 100644
--- a/js/tests/unit/bootstrap-alert.js
+++ b/js/tests/unit/alert.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-alerts")
+ module("alerts")
test("should provide no conflict", function () {
var alert = $.fn.alert.noConflict()
@@ -48,12 +48,12 @@ $(function () {
$.support.transition = false
stop();
$('<div class="alert"/>')
- .bind('close', function (e) {
+ .bind('bs-close', function (e) {
e.preventDefault();
ok(true);
start();
})
- .bind('closed', function () {
+ .bind('bs-closed', function () {
ok(false);
})
.alert('close')
diff --git a/js/tests/unit/bootstrap-typeahead.js b/js/tests/unit/bootstrap-typeahead.js
deleted file mode 100644
index 0aa2d61b17..0000000000
--- a/js/tests/unit/bootstrap-typeahead.js
+++ /dev/null
@@ -1,236 +0,0 @@
-$(function () {
-
- module("bootstrap-typeahead")
-
- test("should provide no conflict", function () {
- var typeahead = $.fn.typeahead.noConflict()
- ok(!$.fn.typeahead, 'typeahead was set back to undefined (org value)')
- $.fn.typeahead = typeahead
- })
-
- test("should be defined on jquery object", function () {
- ok($(document.body).typeahead, 'alert method is defined')
- })
-
- test("should return element", function () {
- ok($(document.body).typeahead()[0] == document.body, 'document.body returned')
- })
-
- test("should listen to an input", function () {
- var $input = $('<input />')
- $input.typeahead()
- ok($._data($input[0], 'events').blur, 'has a blur event')
- ok($._data($input[0], 'events').keypress, 'has a keypress event')
- ok($._data($input[0], 'events').keyup, 'has a keyup event')
- })
-
- test("should create a menu", function () {
- var $input = $('<input />')
- ok($input.typeahead().data('typeahead').$menu, 'has a menu')
- })
-
- test("should listen to the menu", function () {
- var $input = $('<input />')
- , $menu = $input.typeahead().data('typeahead').$menu
-
- ok($._data($menu[0], 'events').mouseover, 'has a mouseover(pseudo: mouseenter)')
- ok($._data($menu[0], 'events').click, 'has a click')
- })
-
- test("should show menu when query entered", function () {
- var $input = $('<input />')
- .appendTo('body')
- .typeahead({
- source: ['aa', 'ab', 'ac']
- })
- , typeahead = $input.data('typeahead')
-
- $input.val('a')
- typeahead.lookup()
-
- ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
- equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
- equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
-
- $input.remove()
- typeahead.$menu.remove()
- })
-
- test("should accept data source via synchronous function", function () {
- var $input = $('<input />').typeahead({
- source: function () {
- return ['aa', 'ab', 'ac']
- }
- }).appendTo('body')
- , typeahead = $input.data('typeahead')
-
- $input.val('a')
- typeahead.lookup()
-
- ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
- equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
- equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
-
- $input.remove()
- typeahead.$menu.remove()
- })
-
- test("should accept data source via asynchronous function", function () {
- var $input = $('<input />').typeahead({
- source: function (query, process) {
- process(['aa', 'ab', 'ac'])
- }
- }).appendTo('body')
- , typeahead = $input.data('typeahead')
-
- $input.val('a')
- typeahead.lookup()
-
- ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
- equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
- equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
-
- $input.remove()
- typeahead.$menu.remove()
- })
-
- test("should not explode when regex chars are entered", function () {
- var $input = $('<input />').typeahead({
- source: ['aa', 'ab', 'ac', 'mdo*', 'fat+']
- }).appendTo('body')
- , typeahead = $input.data('typeahead')
-
- $input.val('+')
- typeahead.lookup()
-
- ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
- equals(typeahead.$menu.find('li').length, 1, 'has 1 item in menu')
- equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
-
- $input.remove()
- typeahead.$menu.remove()
- })
-
- test("should hide menu when query entered", function () {
- stop()
- var $input = $('<input />').typeahead({
- source: ['aa', 'ab', 'ac']
- }).appendTo('body')
- , typeahead = $input.data('typeahead')
-
- $input.val('a')
- typeahead.lookup()
-
- ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
- equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
- equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
-
- $input.blur()
-
- setTimeout(function () {
- ok(!typeahead.$menu.is(":visible"), "typeahead is no longer visible")
- start()
- }, 200)
-
- $input.remove()
- typeahead.$menu.remove()
- })
-
- test("should set next item when down arrow is pressed", function () {
- var $input = $('<input />').typeahead({
- source: ['aa', 'ab', 'ac']
- }).appendTo('body')
- , typeahead = $input.data('typeahead')
-
- $input.val('a')
- typeahead.lookup()
-
- ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
- equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
- equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
- ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
-
- // simulate entire key pressing event
- $input.trigger({
- type: 'keydown'
- , keyCode: 40
- })
- .trigger({
- type: 'keypress'
- , keyCode: 40
- })
- .trigger({
- type: 'keyup'
- , keyCode: 40
- })
-
- ok(typeahead.$menu.find('li').first().next().hasClass('active'), "second item is active")
-
- $input.trigger({
- type: 'keydown'
- , keyCode: 38
- })
- .trigger({
- type: 'keypress'
- , keyCode: 38
- })
- .trigger({
- type: 'keyup'
- , keyCode: 38
- })
-
- ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
-
- $input.remove()
- typeahead.$menu.remove()
- })
-
-
- test("should set input value to selected item", function () {
- var $input = $('<input />').typeahead({
- source: ['aa', 'ab', 'ac']
- }).appendTo('body')
- , typeahead = $input.data('typeahead')
- , changed = false
- , focus = false
- , blur = false
-
- $input.val('a')
- typeahead.lookup()
-
- $input.change(function() { changed = true });
- $input.focus(function() { focus = true; blur = false });
- $input.blur(function() { blur = true; focus = false });
-
- $(typeahead.$menu.find('li')[2]).mouseover().click()
-
- equals($input.val(), 'ac', 'input value was correctly set')
- ok(!typeahead.$menu.is(':visible'), 'the menu was hidden')
- ok(changed, 'a change event was fired')
- ok(focus && !blur, 'focus is still set')
-
- $input.remove()
- typeahead.$menu.remove()
- })
-
- test("should start querying when minLength is met", function () {
- var $input = $('<input />').typeahead({
- source: ['aaaa', 'aaab', 'aaac'],
- minLength: 3
- }).appendTo('body')
- , typeahead = $input.data('typeahead')
-
- $input.val('aa')
- typeahead.lookup()
-
- equals(typeahead.$menu.find('li').length, 0, 'has 0 items in menu')
-
- $input.val('aaa')
- typeahead.lookup()
-
- equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
-
- $input.remove()
- typeahead.$menu.remove()
- })
-})
diff --git a/js/tests/unit/bootstrap-button.js b/js/tests/unit/button.js
index 5849dad7b1..aaf480c32e 100644
--- a/js/tests/unit/bootstrap-button.js
+++ b/js/tests/unit/button.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-buttons")
+ module("buttons")
test("should provide no conflict", function () {
var button = $.fn.button.noConflict()
diff --git a/js/tests/unit/bootstrap-carousel.js b/js/tests/unit/carousel.js
index 1e821173e5..396217e754 100644
--- a/js/tests/unit/bootstrap-carousel.js
+++ b/js/tests/unit/carousel.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-carousel")
+ module("carousel")
test("should provide no conflict", function () {
var carousel = $.fn.carousel.noConflict()
diff --git a/js/tests/unit/bootstrap-collapse.js b/js/tests/unit/collapse.js
index 1f1fc2ff20..6750c7a87a 100644
--- a/js/tests/unit/bootstrap-collapse.js
+++ b/js/tests/unit/collapse.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-collapse")
+ module("collapse")
test("should provide no conflict", function () {
var collapse = $.fn.collapse.noConflict()
diff --git a/js/tests/unit/bootstrap-dropdown.js b/js/tests/unit/dropdown.js
index c67c073008..db84a95a5d 100644
--- a/js/tests/unit/bootstrap-dropdown.js
+++ b/js/tests/unit/dropdown.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-dropdowns")
+ module("dropdowns")
test("should provide no conflict", function () {
var dropdown = $.fn.dropdown.noConflict()
diff --git a/js/tests/unit/bootstrap-modal.js b/js/tests/unit/modal.js
index 3762e72e98..1d3baa8125 100644
--- a/js/tests/unit/bootstrap-modal.js
+++ b/js/tests/unit/modal.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-modal")
+ module("modal")
test("should provide no conflict", function () {
var modal = $.fn.modal.noConflict()
diff --git a/js/tests/unit/bootstrap-phantom.js b/js/tests/unit/phantom.js
index c01e71c154..c01e71c154 100644
--- a/js/tests/unit/bootstrap-phantom.js
+++ b/js/tests/unit/phantom.js
diff --git a/js/tests/unit/bootstrap-popover.js b/js/tests/unit/popover.js
index ef7f5cf3b9..c62bb8ac1b 100644
--- a/js/tests/unit/bootstrap-popover.js
+++ b/js/tests/unit/popover.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-popover")
+ module("popover")
test("should provide no conflict", function () {
var popover = $.fn.popover.noConflict()
diff --git a/js/tests/unit/bootstrap-scrollspy.js b/js/tests/unit/scrollspy.js
index 2c3d438931..06219a1c8d 100644
--- a/js/tests/unit/bootstrap-scrollspy.js
+++ b/js/tests/unit/scrollspy.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-scrollspy")
+ module("scrollspy")
test("should provide no conflict", function () {
var scrollspy = $.fn.scrollspy.noConflict()
diff --git a/js/tests/unit/bootstrap-tab.js b/js/tests/unit/tab.js
index 9a7e93d4db..2a92b4d320 100644
--- a/js/tests/unit/bootstrap-tab.js
+++ b/js/tests/unit/tab.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-tabs")
+ module("tabs")
test("should provide no conflict", function () {
var tab = $.fn.tab.noConflict()
diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/tooltip.js
index 5b37b4e687..b97be3c9bd 100644
--- a/js/tests/unit/bootstrap-tooltip.js
+++ b/js/tests/unit/tooltip.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-tooltip")
+ module("tooltip")
test("should provide no conflict", function () {
var tooltip = $.fn.tooltip.noConflict()
diff --git a/js/tests/unit/bootstrap-transition.js b/js/tests/unit/transition.js
index d348189047..39c415bc23 100644
--- a/js/tests/unit/bootstrap-transition.js
+++ b/js/tests/unit/transition.js
@@ -1,6 +1,6 @@
$(function () {
- module("bootstrap-transition")
+ module("transition")
test("should be defined on jquery support object", function () {
ok($.support.transition !== undefined, 'transition object is defined')