0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-17 14:54:30 +01:00

Remove semicolons from JS tests

This commit is contained in:
Zlatan Vasović 2014-02-17 20:56:46 +01:00
parent 00b3b8b0b8
commit a06e15dd36
4 changed files with 45 additions and 45 deletions

View File

@ -46,15 +46,15 @@ $(function () {
test('should not fire closed when close is prevented', function () { test('should not fire closed when close is prevented', function () {
$.support.transition = false $.support.transition = false
stop(); stop()
$('<div class="alert"/>') $('<div class="alert"/>')
.on('close.bs.alert', function (e) { .on('close.bs.alert', function (e) {
e.preventDefault(); e.preventDefault()
ok(true); ok(true)
start(); start()
}) })
.on('closed.bs.alert', function () { .on('closed.bs.alert', function () {
ok(false); ok(false)
}) })
.alert('close') .alert('close')
}) })

View File

@ -21,12 +21,12 @@ $(function () {
stop() stop()
$('<div class="carousel"/>') $('<div class="carousel"/>')
.on('slide.bs.carousel', function (e) { .on('slide.bs.carousel', function (e) {
e.preventDefault(); e.preventDefault()
ok(true); ok(true)
start(); start()
}) })
.on('slid.bs.carousel', function () { .on('slid.bs.carousel', function () {
ok(false); ok(false)
}) })
.carousel('next') .carousel('next')
}) })
@ -42,14 +42,14 @@ $(function () {
ok($carousel.find('.item:eq(0)').is('.active')) ok($carousel.find('.item:eq(0)').is('.active'))
ok($carousel.find('.carousel-indicators li:eq(0)').is('.active')) ok($carousel.find('.carousel-indicators li:eq(0)').is('.active'))
$carousel.carousel('next') $carousel.carousel('next')
}, 1); }, 1)
}) })
$carousel.one('slid.bs.carousel', function () { $carousel.one('slid.bs.carousel', function () {
setTimeout(function () { setTimeout(function () {
ok($carousel.find('.item:eq(1)').is('.active')) ok($carousel.find('.item:eq(1)').is('.active'))
ok($carousel.find('.carousel-indicators li:eq(1)').is('.active')) ok($carousel.find('.carousel-indicators li:eq(1)').is('.active'))
start() start()
}, 1); }, 1)
}) })
$carousel.carousel('next') $carousel.carousel('next')
}) })
@ -72,39 +72,39 @@ $(function () {
stop() stop()
$(template) $(template)
.on('slide.bs.carousel', function (e) { .on('slide.bs.carousel', function (e) {
e.preventDefault(); e.preventDefault()
ok(e.relatedTarget); ok(e.relatedTarget)
ok($(e.relatedTarget).hasClass('item')); ok($(e.relatedTarget).hasClass('item'))
start(); start()
}) })
.carousel('next') .carousel('next')
}) })
test('should set interval from data attribute', 4, function () { test('should set interval from data attribute', 4, function () {
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">&lsaquo;</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a> </div>'); 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">&lsaquo;</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a> </div>')
template.attr('data-interval', 1814); template.attr('data-interval', 1814)
template.appendTo('body'); template.appendTo('body')
$('[data-slide]').first().click(); $('[data-slide]').first().click()
ok($('#myCarousel').data('bs.carousel').options.interval == 1814); ok($('#myCarousel').data('bs.carousel').options.interval == 1814)
$('#myCarousel').remove(); $('#myCarousel').remove()
template.appendTo('body').attr('data-modal', 'foobar'); template.appendTo('body').attr('data-modal', 'foobar')
$('[data-slide]').first().click(); $('[data-slide]').first().click()
ok($('#myCarousel').data('bs.carousel').options.interval == 1814, 'even if there is an data-modal attribute set'); ok($('#myCarousel').data('bs.carousel').options.interval == 1814, 'even if there is an data-modal attribute set')
$('#myCarousel').remove(); $('#myCarousel').remove()
template.appendTo('body'); template.appendTo('body')
$('[data-slide]').first().click(); $('[data-slide]').first().click()
$('#myCarousel').attr('data-interval', 1860); $('#myCarousel').attr('data-interval', 1860)
$('[data-slide]').first().click(); $('[data-slide]').first().click()
ok($('#myCarousel').data('bs.carousel').options.interval == 1814, 'attributes should be read only on intitialization'); ok($('#myCarousel').data('bs.carousel').options.interval == 1814, 'attributes should be read only on intitialization')
$('#myCarousel').remove(); $('#myCarousel').remove()
template.attr('data-interval', false); template.attr('data-interval', false)
template.appendTo('body'); template.appendTo('body')
$('#myCarousel').carousel(1); $('#myCarousel').carousel(1)
ok($('#myCarousel').data('bs.carousel').options.interval === false, 'data attribute has higher priority than default options'); ok($('#myCarousel').data('bs.carousel').options.interval === false, 'data attribute has higher priority than default options')
$('#myCarousel').remove(); $('#myCarousel').remove()
}) })
}) })

View File

@ -33,12 +33,12 @@ $(function () {
stop() stop()
$('<div class="collapse"/>') $('<div class="collapse"/>')
.on('show.bs.collapse', function (e) { .on('show.bs.collapse', function (e) {
e.preventDefault(); e.preventDefault()
ok(true); ok(true)
start(); start()
}) })
.on('shown.bs.collapse', function () { .on('shown.bs.collapse', function () {
ok(false); ok(false)
}) })
.collapse('show') .collapse('show')
}) })

View File

@ -49,15 +49,15 @@ $(function () {
test('should not fire closed when close is prevented', function () { test('should not fire closed when close is prevented', function () {
$.support.transition = false $.support.transition = false
stop(); stop()
$('<div class="tab"/>') $('<div class="tab"/>')
.on('show.bs.tab', function (e) { .on('show.bs.tab', function (e) {
e.preventDefault(); e.preventDefault()
ok(true); ok(true)
start(); start()
}) })
.on('shown.bs.tab', function () { .on('shown.bs.tab', function () {
ok(false); ok(false)
}) })
.tab('show') .tab('show')
}) })