updated composer
This commit is contained in:
+14
-1
@@ -480,7 +480,7 @@ $(function () {
|
||||
})
|
||||
|
||||
QUnit.test('should set interval from data attribute on individual carousel-item', function (assert) {
|
||||
assert.expect(2)
|
||||
assert.expect(4)
|
||||
var templateHTML = '<div id="myCarousel" class="carousel slide" data-interval="1814">' +
|
||||
'<div class="carousel-inner">' +
|
||||
'<div class="carousel-item active" data-interval="2814">' +
|
||||
@@ -516,13 +516,26 @@ $(function () {
|
||||
'</div>'
|
||||
var $carousel = $(templateHTML)
|
||||
|
||||
$carousel.appendTo('body')
|
||||
$carousel.bootstrapCarousel()
|
||||
assert.strictEqual($carousel.data('bs.carousel')._config.interval, 1814)
|
||||
$carousel.remove()
|
||||
|
||||
$carousel.appendTo('body')
|
||||
$carousel.bootstrapCarousel(0)
|
||||
$carousel.data('bs.carousel').cycle()
|
||||
assert.strictEqual($carousel.data('bs.carousel')._config.interval, 2814)
|
||||
$carousel.remove()
|
||||
|
||||
$carousel.appendTo('body')
|
||||
$carousel.bootstrapCarousel(1)
|
||||
$carousel.data('bs.carousel').cycle()
|
||||
assert.strictEqual($carousel.data('bs.carousel')._config.interval, 3814)
|
||||
$carousel.remove()
|
||||
|
||||
$carousel.appendTo('body')
|
||||
$carousel.bootstrapCarousel(2)
|
||||
$carousel.data('bs.carousel').cycle()
|
||||
assert.strictEqual($carousel.data('bs.carousel')._config.interval, 1814, 'reverts to default interval if no data-interval is set')
|
||||
$carousel.remove()
|
||||
})
|
||||
|
||||
+6
-6
@@ -747,7 +747,7 @@ $(function () {
|
||||
$dropdown.trigger('click')
|
||||
})
|
||||
|
||||
QUnit.test('Dropdown should not use Popper.js in navbar', function (assert) {
|
||||
QUnit.test('Dropdown should not use Popper in navbar', function (assert) {
|
||||
assert.expect(1)
|
||||
var done = assert.async()
|
||||
var html = '<nav class="navbar navbar-expand-md navbar-light bg-light">' +
|
||||
@@ -770,7 +770,7 @@ $(function () {
|
||||
$triggerDropdown
|
||||
.parent('.dropdown')
|
||||
.on('shown.bs.dropdown', function () {
|
||||
assert.ok(typeof $dropdownMenu.attr('style') === 'undefined', 'No inline style applied by Popper.js')
|
||||
assert.ok(typeof $dropdownMenu.attr('style') === 'undefined', 'No inline style applied by Popper')
|
||||
done()
|
||||
})
|
||||
$triggerDropdown.trigger($.Event('click'))
|
||||
@@ -1084,7 +1084,7 @@ $(function () {
|
||||
done()
|
||||
})
|
||||
|
||||
QUnit.test('should not use Popper.js if display set to static', function (assert) {
|
||||
QUnit.test('should not use Popper if display set to static', function (assert) {
|
||||
assert.expect(1)
|
||||
var dropdownHTML =
|
||||
'<div class="dropdown">' +
|
||||
@@ -1106,7 +1106,7 @@ $(function () {
|
||||
|
||||
$dropdown.parent('.dropdown')
|
||||
.on('shown.bs.dropdown', function () {
|
||||
// Popper.js add this attribute when we use it
|
||||
// Popper adds this attribute when we use it
|
||||
assert.strictEqual(dropdownMenu.getAttribute('x-placement'), null)
|
||||
done()
|
||||
})
|
||||
@@ -1114,7 +1114,7 @@ $(function () {
|
||||
$dropdown.trigger('click')
|
||||
})
|
||||
|
||||
QUnit.test('should call Popper.js and detect navbar on update', function (assert) {
|
||||
QUnit.test('should call Popper and detect navbar on update', function (assert) {
|
||||
assert.expect(3)
|
||||
|
||||
var dropdownHTML =
|
||||
@@ -1546,7 +1546,7 @@ $(function () {
|
||||
assert.ok(typeof offset.fn === 'undefined')
|
||||
})
|
||||
|
||||
QUnit.test('should allow to pass config to popper.js with `popperConfig`', function (assert) {
|
||||
QUnit.test('should allow to pass config to Popper with `popperConfig`', function (assert) {
|
||||
assert.expect(1)
|
||||
|
||||
var dropdownHTML =
|
||||
|
||||
+2
-3
@@ -934,10 +934,10 @@ $(function () {
|
||||
})
|
||||
})
|
||||
|
||||
QUnit.test('should not close modal when escape key is pressed with keyboard = false and backdrop = static', function (assert) {
|
||||
QUnit.test('should not close modal when escape key is pressed with keyboard = false', function (assert) {
|
||||
assert.expect(1)
|
||||
var done = assert.async()
|
||||
var $modal = $('<div class="modal" data-backdrop="static" data-keyboard="false"><div class="modal-dialog" /></div>').appendTo('#qunit-fixture')
|
||||
var $modal = $('<div class="modal"><div class="modal-dialog" /></div>').appendTo('#qunit-fixture')
|
||||
|
||||
$modal.on('shown.bs.modal', function () {
|
||||
$modal.trigger($.Event('keydown', {
|
||||
@@ -955,7 +955,6 @@ $(function () {
|
||||
assert.strictEqual(false, true, 'should not hide the modal')
|
||||
})
|
||||
.bootstrapModal({
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
})
|
||||
})
|
||||
|
||||
+13
@@ -61,6 +61,19 @@ $(function () {
|
||||
.bootstrapPopover('show')
|
||||
})
|
||||
|
||||
QUnit.test('should render popover element with additional classes', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
$('<a href="#" title="mdo" data-content="https://twitter.com/mdo" data-custom-class="a b">@mdo</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.popover', function () {
|
||||
assert.strictEqual($('.popover').hasClass('popover fade bs-popover-right show'), true, 'has default classes')
|
||||
assert.strictEqual($('.popover').hasClass('a b'), true, 'has custom classes')
|
||||
done()
|
||||
})
|
||||
.bootstrapPopover('show')
|
||||
})
|
||||
|
||||
QUnit.test('should store popover instance in popover data object', function (assert) {
|
||||
assert.expect(1)
|
||||
var $popover = $('<a href="#" title="mdo" data-content="https://twitter.com/mdo">@mdo</a>').bootstrapPopover()
|
||||
|
||||
+55
-5
@@ -998,7 +998,7 @@ $(function () {
|
||||
}, 200)
|
||||
})
|
||||
|
||||
QUnit.test('should call Popper.js to update', function (assert) {
|
||||
QUnit.test('should call Popper to update', function (assert) {
|
||||
assert.expect(2)
|
||||
|
||||
var $tooltip = $('<a href="#" rel="tooltip" data-trigger="click" title="Another tooltip"/>')
|
||||
@@ -1014,7 +1014,7 @@ $(function () {
|
||||
assert.ok(spyPopper.called)
|
||||
})
|
||||
|
||||
QUnit.test('should not call Popper.js to update', function (assert) {
|
||||
QUnit.test('should not call Popper to update', function (assert) {
|
||||
assert.expect(1)
|
||||
|
||||
var $tooltip = $('<a href="#" rel="tooltip" data-trigger="click" title="Another tooltip"/>')
|
||||
@@ -1027,7 +1027,7 @@ $(function () {
|
||||
assert.ok(tooltip._popper === null)
|
||||
})
|
||||
|
||||
QUnit.test('should use Popper.js to get the tip on placement change', function (assert) {
|
||||
QUnit.test('should use Popper to get the tip on placement change', function (assert) {
|
||||
assert.expect(1)
|
||||
|
||||
var $tooltip = $('<a href="#" rel="tooltip" data-trigger="click" title="Another tooltip"/>')
|
||||
@@ -1170,7 +1170,7 @@ $(function () {
|
||||
})
|
||||
|
||||
var tooltip = $trigger.data('bs.tooltip')
|
||||
assert.strictEqual(tooltip.config.template.indexOf('script'), -1)
|
||||
assert.strictEqual(tooltip.config.template.indexOf('href="javascript:alert(7)"'), -1)
|
||||
})
|
||||
|
||||
QUnit.test('should allow custom sanitization rules', function (assert) {
|
||||
@@ -1267,7 +1267,7 @@ $(function () {
|
||||
assert.strictEqual(tooltip.config.sanitize, true)
|
||||
})
|
||||
|
||||
QUnit.test('should allow to pass config to popper.js with `popperConfig`', function (assert) {
|
||||
QUnit.test('should allow to pass config to Popper with `popperConfig`', function (assert) {
|
||||
assert.expect(1)
|
||||
|
||||
var $trigger = $('<a href="#" rel="tooltip" data-trigger="click" title="Another tooltip"/>')
|
||||
@@ -1283,4 +1283,54 @@ $(function () {
|
||||
|
||||
assert.strictEqual(popperConfig.placement, 'left')
|
||||
})
|
||||
|
||||
QUnit.test('additional classes can be applied via data attribute', function (assert) {
|
||||
assert.expect(2)
|
||||
|
||||
$('<a href="#" rel="tooltip" data-trigger="click" title="Another tooltip" data-custom-class="a b"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip()
|
||||
.bootstrapTooltip('show')
|
||||
|
||||
var tooltip = $('.tooltip')
|
||||
|
||||
assert.strictEqual(tooltip.hasClass('a b'), true)
|
||||
assert.strictEqual(tooltip.hasClass('tooltip fade bs-tooltip-top show'), true)
|
||||
})
|
||||
|
||||
QUnit.test('additional classes can be applied via config string', function (assert) {
|
||||
assert.expect(2)
|
||||
|
||||
$('<a href="#" rel="tooltip" data-trigger="click" title="Another tooltip" />')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip({
|
||||
customClass: 'a b'
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
|
||||
var tooltip = $('.tooltip')
|
||||
|
||||
assert.strictEqual(tooltip.hasClass('a b'), true)
|
||||
assert.strictEqual(tooltip.hasClass('tooltip fade bs-tooltip-top show'), true)
|
||||
})
|
||||
|
||||
QUnit.test('additional classes can be applied via function', function (assert) {
|
||||
assert.expect(2)
|
||||
|
||||
var getClasses = function () {
|
||||
return 'a b'
|
||||
}
|
||||
|
||||
$('<a href="#" rel="tooltip" data-trigger="click" title="Another tooltip" />')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip({
|
||||
customClass: getClasses
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
|
||||
var tooltip = $('.tooltip')
|
||||
|
||||
assert.strictEqual(tooltip.hasClass('a b'), true)
|
||||
assert.strictEqual(tooltip.hasClass('tooltip fade bs-tooltip-top show'), true)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user