1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-16 10:34:07 +02:00

bootstrap onto closure

This commit is contained in:
fat
2015-01-03 13:58:44 -08:00
parent aed1cd3121
commit 834220ea20
38 changed files with 10739 additions and 4110 deletions

View File

@@ -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')

View File

@@ -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()
})

View File

@@ -288,7 +288,7 @@ $(function () {
$body2
.toggleClass('in collapsing')
.data('bs.collapse').transitioning = 1
.data('bs.collapse').setTransitioning(true)
$target1.click()

View File

@@ -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) {

View File

@@ -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')
})