aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests/unit')
-rw-r--r--js/tests/unit/modal.js7
-rw-r--r--js/tests/unit/tab.js9
-rw-r--r--js/tests/unit/tooltip.js17
-rw-r--r--js/tests/unit/transition.js13
4 files changed, 15 insertions, 31 deletions
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index 6b2074327..281978142 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -157,16 +157,15 @@ $(function () {
test('should trigger hide event once when clicking outside of modal-content', function () {
stop()
$.support.transition = false
- var div = $('<div id="modal-test"><div class="contents"></div></div>')
+
var triggered
+ var div = $('<div id="modal-test"><div class="contents"></div></div>')
+
div
.bind('shown.bs.modal', function () {
triggered = 0
$('#modal-test').click()
})
- .one('hidden.bs.modal', function () {
- div.modal('show')
- })
.bind('hide.bs.modal', function () {
triggered += 1
ok(triggered === 1, 'modal hide triggered once')
diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js
index 59bedf391..b8dbf2c18 100644
--- a/js/tests/unit/tab.js
+++ b/js/tests/unit/tab.js
@@ -73,11 +73,14 @@ $(function () {
'</ul>'
$(dropHTML).find('ul>li:first a').tab('show').end()
- .find('ul>li:last a').on('show', function (event) {
+ .find('ul>li:last a')
+ .on('show.bs.tab', function (event) {
equal(event.relatedTarget.hash, '#1-1')
- }).on('shown', function (event) {
+ })
+ .on('show.bs.tab', function (event) {
equal(event.relatedTarget.hash, '#1-1')
- }).tab('show')
+ })
+ .tab('show')
})
})
diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js
index d921bee7f..b9b003dd1 100644
--- a/js/tests/unit/tooltip.js
+++ b/js/tests/unit/tooltip.js
@@ -332,7 +332,7 @@ $(function () {
var tooltip = container.find('.tooltip')
start()
- ok(tooltip.offset().top + tooltip.outerHeight() <= tooltiped.offset().top)
+ ok(Math.round(tooltip.offset().top + tooltip.outerHeight()) <= Math.round(tooltiped.offset().top))
container.remove()
}, 100)
})
@@ -347,7 +347,11 @@ $(function () {
.tooltip('show'),
tooltip = container.find('.tooltip')
- ok( Math.round(target.offset().top + (target[0].offsetHeight / 2) - (tooltip[0].offsetHeight / 2)) === Math.round(tooltip.offset().top) )
+ // this is some dumb hack shit because sub pixels in firefox
+ var top = Math.round(target.offset().top + (target[0].offsetHeight / 2) - (tooltip[0].offsetHeight / 2))
+ var top2 = Math.round(tooltip.offset().top)
+ var topDiff = top - top2
+ ok(topDiff <= 1 && topDiff >= -1)
target.tooltip('hide')
})
@@ -402,7 +406,6 @@ $(function () {
.tooltip({placement: 'auto'})
.tooltip('show')
-
ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned bottom')
topTooltip.tooltip('hide')
@@ -415,14 +418,6 @@ $(function () {
ok($('.tooltip').is('.left'), 'right positioned tooltip is dynamically positioned left')
rightTooltip.tooltip('hide')
- var bottomTooltip = $('<div style="display: inline-block; position: absolute; bottom: 0;" rel="tooltip" title="Bottom tooltip">Bottom Dynamic Tooltip</div>')
- .appendTo('#dynamic-tt-test')
- .tooltip({placement: 'auto bottom'})
- .tooltip('show')
-
- ok($('.tooltip').is('.top'), 'bottom positioned tooltip is dynamically positioned top')
- bottomTooltip.tooltip('hide')
-
var leftTooltip = $('<div style="display: inline-block; position: absolute; left: 0;" rel="tooltip" title="Left tooltip">Left Dynamic Tooltip</div>')
.appendTo('#dynamic-tt-test')
.tooltip({placement: 'auto left'})
diff --git a/js/tests/unit/transition.js b/js/tests/unit/transition.js
deleted file mode 100644
index 79722f808..000000000
--- a/js/tests/unit/transition.js
+++ /dev/null
@@ -1,13 +0,0 @@
-$(function () {
-
- module('transition')
-
- test('should be defined on jquery support object', function () {
- ok($.support.transition !== undefined, 'transition object is defined')
- })
-
- test('should provide an end object', function () {
- ok($.support.transition ? $.support.transition.end : true, 'end string is defined')
- })
-
-})