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
diff options
context:
space:
mode:
authorfat <jacobthornton@gmail.com>2015-01-04 00:58:44 +0300
committerfat <jacobthornton@gmail.com>2015-02-11 22:29:43 +0300
commit834220ea20ce5b7cd31edfb624a28b4bf8b29a6a (patch)
tree19bfdadb0c140df437e7b7034e5e1f5ce58343cc /js/tests/unit
parentaed1cd31218113d67d2eca3296edf5d1700b19b8 (diff)
bootstrap onto closure
Diffstat (limited to 'js/tests/unit')
-rw-r--r--js/tests/unit/button.js55
-rw-r--r--js/tests/unit/carousel.js9
-rw-r--r--js/tests/unit/collapse.js2
-rw-r--r--js/tests/unit/modal.js2
-rw-r--r--js/tests/unit/tooltip.js22
5 files changed, 19 insertions, 71 deletions
diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js
index cb51d40b95..08b071d655 100644
--- a/js/tests/unit/button.js
+++ b/js/tests/unit/button.js
@@ -29,61 +29,6 @@ $(function () {
strictEqual($button[0], $el[0], 'collection contains element')
})
- test('should return set state to loading', function (assert) {
- var $btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
- equal($btn.html(), 'mdo', 'btn text equals mdo')
- $btn.bootstrapButton('loading')
- var done = assert.async()
- setTimeout(function () {
- equal($btn.html(), 'fat', 'btn text equals fat')
- ok($btn[0].hasAttribute('disabled'), 'btn is disabled')
- ok($btn.hasClass('disabled'), 'btn has disabled class')
- done()
- }, 0)
- })
-
- test('should return reset state', function (assert) {
- var $btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
- equal($btn.html(), 'mdo', 'btn text equals mdo')
- $btn.bootstrapButton('loading')
- var doneOne = assert.async()
- setTimeout(function () {
- equal($btn.html(), 'fat', 'btn text equals fat')
- ok($btn[0].hasAttribute('disabled'), 'btn is disabled')
- ok($btn.hasClass('disabled'), 'btn has disabled class')
- doneOne()
- var doneTwo = assert.async()
- $btn.bootstrapButton('reset')
- setTimeout(function () {
- equal($btn.html(), 'mdo', 'btn text equals mdo')
- ok(!$btn[0].hasAttribute('disabled'), 'btn is not disabled')
- ok(!$btn.hasClass('disabled'), 'btn does not have disabled class')
- doneTwo()
- }, 0)
- }, 0)
- })
-
- test('should work with an empty string as reset state', function (assert) {
- var $btn = $('<button class="btn" data-loading-text="fat"/>')
- equal($btn.html(), '', 'btn text equals ""')
- $btn.bootstrapButton('loading')
- var doneOne = assert.async()
- setTimeout(function () {
- equal($btn.html(), 'fat', 'btn text equals fat')
- ok($btn[0].hasAttribute('disabled'), 'btn is disabled')
- ok($btn.hasClass('disabled'), 'btn has disabled class')
- doneOne()
- var doneTwo = assert.async()
- $btn.bootstrapButton('reset')
- setTimeout(function () {
- equal($btn.html(), '', 'btn text equals ""')
- ok(!$btn[0].hasAttribute('disabled'), 'btn is not disabled')
- ok(!$btn.hasClass('disabled'), 'btn does not have disabled class')
- doneTwo()
- }, 0)
- }, 0)
- })
-
test('should toggle active', function () {
var $btn = $('<button class="btn" data-toggle="button">mdo</button>')
ok(!$btn.hasClass('active'), 'btn does not have active class')
diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js
index 6da932d2c2..2ad2c67347 100644
--- a/js/tests/unit/carousel.js
+++ b/js/tests/unit/carousel.js
@@ -322,30 +322,31 @@ $(function () {
+ '<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>'
+ '<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>'
+ '</div>'
+
var $carousel = $(templateHTML)
$carousel.attr('data-interval', 1814)
$carousel.appendTo('body')
$('[data-slide]').first().click()
- equal($carousel.data('bs.carousel').options.interval, 1814)
+ equal($carousel.data('bs.carousel').getConfig().interval, 1814)
$carousel.remove()
$carousel.appendTo('body').attr('data-modal', 'foobar')
$('[data-slide]').first().click()
- equal($carousel.data('bs.carousel').options.interval, 1814, 'even if there is an data-modal attribute set')
+ equal($carousel.data('bs.carousel').getConfig().interval, 1814, 'even if there is an data-modal attribute set')
$carousel.remove()
$carousel.appendTo('body')
$('[data-slide]').first().click()
$carousel.attr('data-interval', 1860)
$('[data-slide]').first().click()
- equal($carousel.data('bs.carousel').options.interval, 1814, 'attributes should be read only on initialization')
+ equal($carousel.data('bs.carousel').getConfig().interval, 1814, 'attributes should be read only on initialization')
$carousel.remove()
$carousel.attr('data-interval', false)
$carousel.appendTo('body')
$carousel.bootstrapCarousel(1)
- strictEqual($carousel.data('bs.carousel').options.interval, false, 'data attribute has higher priority than default options')
+ strictEqual($carousel.data('bs.carousel').getConfig().interval, false, 'data attribute has higher priority than default options')
$carousel.remove()
})
diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js
index ad59d87dbc..ac6e657b38 100644
--- a/js/tests/unit/collapse.js
+++ b/js/tests/unit/collapse.js
@@ -288,7 +288,7 @@ $(function () {
$body2
.toggleClass('in collapsing')
- .data('bs.collapse').transitioning = 1
+ .data('bs.collapse').setTransitioning(true)
$target1.click()
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index c1af15a2f9..7018b865f3 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -30,7 +30,7 @@ $(function () {
})
test('should expose defaults var for settings', function () {
- ok($.fn.bootstrapModal.Constructor.DEFAULTS, 'default object exposed')
+ ok($.fn.bootstrapModal.Constructor.Defaults, 'default object exposed')
})
test('should insert into dom when show method is called', function (assert) {
diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js
index 20efff8cc0..2b63a3b48c 100644
--- a/js/tests/unit/tooltip.js
+++ b/js/tests/unit/tooltip.js
@@ -30,7 +30,7 @@ $(function () {
})
test('should expose default settings', function () {
- ok($.fn.bootstrapTooltip.Constructor.DEFAULTS, 'defaults is defined')
+ ok($.fn.bootstrapTooltip.Constructor.Defaults, 'defaults is defined')
})
test('should empty title attribute', function () {
@@ -879,17 +879,17 @@ $(function () {
.bootstrapTooltip({ delay: { show: 0, hide: 150 }})
setTimeout(function () {
- ok($tooltip.data('bs.tooltip').$tip.is('.fade.in'), '1ms: tooltip faded in')
+ ok($('.tooltip').is('.fade.in'), '1ms: tooltip faded in')
$tooltip.trigger('mouseout')
setTimeout(function () {
- ok($tooltip.data('bs.tooltip').$tip.is('.fade.in'), '100ms: tooltip still faded in')
+ ok($('.tooltip').is('.fade.in'), '100ms: tooltip still faded in')
}, 100)
setTimeout(function () {
- ok(!$tooltip.data('bs.tooltip').$tip.is('.in'), '200ms: tooltip removed')
- done()
+ ok(!$('.tooltip').is('.in'), '200ms: tooltip removed')
+ start()
}, 200)
}, 0)
@@ -978,7 +978,7 @@ $(function () {
test('should not reload the tooltip on subsequent mouseenter events', function () {
var titleHtml = function () {
- var uid = $.fn.bootstrapTooltip.Constructor.prototype.getUID('tooltip')
+ var uid = 'fatTooltip'
return '<p id="tt-content">' + uid + '</p><p>' + uid + '</p><p>' + uid + '</p>'
}
@@ -1004,7 +1004,7 @@ $(function () {
test('should not reload the tooltip if the mouse leaves and re-enters before hiding', function () {
var titleHtml = function () {
- var uid = $.fn.bootstrapTooltip.Constructor.prototype.getUID('tooltip')
+ var uid = 'fatTooltip'
return '<p id="tt-content">' + uid + '</p><p>' + uid + '</p><p>' + uid + '</p>'
}
@@ -1029,10 +1029,12 @@ $(function () {
$('#tt-outer').trigger('mouseleave')
equal(currentUid, $('#tt-content').text())
- ok(obj.hoverState == 'out', 'the tooltip hoverState should be set to "out"')
+ debugger
+
+ ok(obj.getHoverState() == 'out', 'the tooltip hoverState should be set to "out"')
$('#tt-content').trigger('mouseenter')
- ok(obj.hoverState == 'in', 'the tooltip hoverState should be set to "in"')
+ ok(obj.getHoverState() == 'in', 'the tooltip hoverState should be set to "in"')
equal(currentUid, $('#tt-content').text())
})
@@ -1051,7 +1053,7 @@ $(function () {
$('<a href="#" title="tooltip title" style="position: absolute; bottom: 0; right: 0;">Foobar</a>')
.appendTo('body')
.on('shown.bs.tooltip', function () {
- var arrowStyles = $(this).data('bs.tooltip').$tip.find('.tooltip-arrow').attr('style')
+ var arrowStyles = $('.tooltip').find('.tooltip-arrow').attr('style')
ok(/left/i.test(arrowStyles) && !/top/i.test(arrowStyles), 'arrow positioned correctly')
$(this).bootstrapTooltip('hide')
})