2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-08 17:22:31 +03:00

Comply to the new rules.

This commit is contained in:
XhmikosR
2019-02-26 13:20:34 +02:00
parent 44e6abcba5
commit 46c037410b
44 changed files with 854 additions and 771 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
$(function () {
'use strict'
var Alert = typeof window.bootstrap !== 'undefined' ? window.bootstrap.Alert : window.Alert
var Alert = typeof window.bootstrap === 'undefined' ? window.Alert : window.bootstrap.Alert
QUnit.module('alert plugin')
+1 -1
View File
@@ -1,7 +1,7 @@
$(function () {
'use strict'
var Button = typeof window.bootstrap !== 'undefined' ? window.bootstrap.Button : window.Button
var Button = typeof window.bootstrap === 'undefined' ? window.Button : window.bootstrap.Button
QUnit.module('button plugin')
+11 -7
View File
@@ -1,7 +1,7 @@
$(function () {
'use strict'
window.Carousel = typeof bootstrap !== 'undefined' ? bootstrap.Carousel : Carousel
window.Carousel = typeof bootstrap === 'undefined' ? Carousel : bootstrap.Carousel
var originWinPointerEvent = window.PointerEvent
window.MSPointerEvent = null
@@ -65,8 +65,8 @@ $(function () {
$el.bootstrapCarousel()
try {
$el.bootstrapCarousel('noMethod')
} catch (err) {
assert.strictEqual(err.message, 'No method named "noMethod"')
} catch (error) {
assert.strictEqual(error.message, 'No method named "noMethod"')
}
})
@@ -89,8 +89,8 @@ $(function () {
try {
$('<div/>').bootstrapCarousel(config)
} catch (err) {
message = err.message
} catch (error) {
message = error.message
}
assert.ok(message === expectedMessage, 'correct error message')
@@ -102,8 +102,8 @@ $(function () {
try {
$('<div/>').bootstrapCarousel(config)
} catch (err) {
message = err.message
} catch (error) {
message = error.message
}
assert.ok(message === expectedMessage, 'correct error message')
@@ -161,6 +161,7 @@ $(function () {
}, 0)
$carousel[0].removeEventListener('slide.bs.carousel', onSlide)
}
$carousel[0].addEventListener('slide.bs.carousel', onSlide)
function onSlid() {
@@ -173,6 +174,7 @@ $(function () {
}, 0)
$carousel[0].removeEventListener('slid.bs.carousel', onSlid)
}
$carousel[0].addEventListener('slid.bs.carousel', onSlid)
$carousel.bootstrapCarousel('next')
@@ -682,6 +684,7 @@ $(function () {
assert.strictEqual(event.defaultPrevented, false)
$template[0].removeEventListener('keydown', handlerKeydown)
}
$template[0].addEventListener('keydown', handlerKeydown)
// arrow down
@@ -694,6 +697,7 @@ $(function () {
$template[0].addEventListener('keydown', handlerKeydown2)
done()
}
$template[0].addEventListener('keydown', handlerKeydown2)
// arrow up
+9 -9
View File
@@ -1,7 +1,7 @@
$(function () {
'use strict'
var Collapse = typeof window.bootstrap !== 'undefined' ? window.bootstrap.Collapse : window.Collapse
var Collapse = typeof window.bootstrap === 'undefined' ? window.Collapse : window.bootstrap.Collapse
QUnit.module('collapse plugin')
@@ -33,8 +33,8 @@ $(function () {
$el.bootstrapCollapse()
try {
$el.bootstrapCollapse('noMethod')
} catch (err) {
assert.strictEqual(err.message, 'No method named "noMethod"')
} catch (error) {
assert.strictEqual(error.message, 'No method named "noMethod"')
}
})
@@ -459,7 +459,7 @@ $(function () {
'<div class="card"/>' +
'</div>'
var showFired = false
var $groups = $(accordionHTML).appendTo('#qunit-fixture').find('.card')
var $groups = $(accordionHTML).appendTo('#qunit-fixture').find('.card')
var $target1 = $('<a role="button" data-toggle="collapse" href="#body1"/>').appendTo($groups.eq(0))
@@ -470,7 +470,7 @@ $(function () {
})
var $target2 = $('<a role="button" data-toggle="collapse" href="#body2"/>').appendTo($groups.eq(1))
var $body2 = $('<div id="body2" class="collapse" data-parent="#accordion"/>').appendTo($groups.eq(1))
var $body2 = $('<div id="body2" class="collapse" data-parent="#accordion"/>').appendTo($groups.eq(1))
$target2[0].dispatchEvent(new Event('click'))
@@ -607,8 +607,8 @@ $(function () {
var $collapseTwoOne = $('#collapseTwoOne')
var $collapseTwoTwo = $('#collapseTwoTwo')
var collapsedElements = {
one : false,
two : false
one: false,
two: false
}
function firstTest() {
@@ -838,7 +838,7 @@ $(function () {
parent: $('.my-collapse')
})
assert.ok(true, 'collapse correctly created')
} catch (err) {
} catch (error) {
assert.ok(false, 'collapse not created')
}
})
@@ -859,7 +859,7 @@ $(function () {
parent: $('.my-collapse')[0]
})
assert.ok(true, 'collapse correctly created')
} catch (err) {
} catch (error) {
assert.ok(false, 'collapse not created')
}
})
+3 -3
View File
@@ -1,7 +1,7 @@
$(function () {
'use strict'
var Dropdown = typeof window.bootstrap !== 'undefined' ? window.bootstrap.Dropdown : window.Dropdown
var Dropdown = typeof window.bootstrap === 'undefined' ? window.Dropdown : window.bootstrap.Dropdown
QUnit.module('dropdowns plugin')
@@ -34,8 +34,8 @@ $(function () {
$el.bootstrapDropdown()
try {
$el.bootstrapDropdown('noMethod')
} catch (err) {
assert.strictEqual(err.message, 'No method named "noMethod"')
} catch (error) {
assert.strictEqual(error.message, 'No method named "noMethod"')
}
})
+7 -6
View File
@@ -1,8 +1,8 @@
$(function () {
'use strict'
window.Util = typeof bootstrap !== 'undefined' ? bootstrap.Util : Util
var Modal = typeof window.bootstrap !== 'undefined' ? window.bootstrap.Modal : window.Modal
window.Util = typeof bootstrap === 'undefined' ? Util : bootstrap.Util
var Modal = typeof window.bootstrap === 'undefined' ? window.Modal : window.bootstrap.Modal
QUnit.module('modal plugin')
@@ -45,8 +45,8 @@ $(function () {
$el.bootstrapModal()
try {
$el.bootstrapModal('noMethod')
} catch (err) {
assert.strictEqual(err.message, 'No method named "noMethod"')
} catch (error) {
assert.strictEqual(error.message, 'No method named "noMethod"')
}
})
@@ -460,8 +460,8 @@ $(function () {
var originalPadding = $body.css('padding-right')
// Hide scrollbars to prevent the body overflowing
$body.css('overflow', 'hidden') // Real scrollbar (for in-browser testing)
$('html').css('padding-right', '0px') // Simulated scrollbar (for PhantomJS)
$body.css('overflow', 'hidden') // Real scrollbar (for in-browser testing)
$('html').css('padding-right', '0px') // Simulated scrollbar (for PhantomJS)
$('<div id="modal-test"><div class="modal-dialog" /></div>')
.on('shown.bs.modal', function () {
@@ -758,6 +758,7 @@ $(function () {
document.removeEventListener('focusin', focusInListener)
done()
}
document.addEventListener('focusin', focusInListener)
var focusInEvent = new Event('focusin')
+5 -5
View File
@@ -1,7 +1,7 @@
$(function () {
'use strict'
var Popover = typeof window.bootstrap !== 'undefined' ? window.bootstrap.Popover : window.Popover
var Popover = typeof window.bootstrap === 'undefined' ? window.Popover : window.bootstrap.Popover
QUnit.module('popover plugin')
@@ -34,8 +34,8 @@ $(function () {
$el.bootstrapPopover()
try {
$el.bootstrapPopover('noMethod')
} catch (err) {
assert.strictEqual(err.message, 'No method named "noMethod"')
} catch (error) {
assert.strictEqual(error.message, 'No method named "noMethod"')
}
})
@@ -367,8 +367,8 @@ $(function () {
try {
$('<div data-toggle="popover" data-title="some title" data-content="@Johann-S" style="display: none"/>').bootstrapPopover('show')
} catch (err) {
assert.strictEqual(err.message, 'Please use show on visible elements')
} catch (error) {
assert.strictEqual(error.message, 'Please use show on visible elements')
done()
}
})
+3 -3
View File
@@ -1,7 +1,7 @@
$(function () {
'use strict'
var ScrollSpy = typeof window.bootstrap !== 'undefined' ? window.bootstrap.ScrollSpy : window.ScrollSpy
var ScrollSpy = typeof window.bootstrap === 'undefined' ? window.ScrollSpy : window.bootstrap.ScrollSpy
QUnit.module('scrollspy plugin')
@@ -33,8 +33,8 @@ $(function () {
$el.bootstrapScrollspy()
try {
$el.bootstrapScrollspy('noMethod')
} catch (err) {
assert.strictEqual(err.message, 'No method named "noMethod"')
} catch (error) {
assert.strictEqual(error.message, 'No method named "noMethod"')
}
})
+4 -4
View File
@@ -33,8 +33,8 @@ $(function () {
$el.bootstrapTab()
try {
$el.bootstrapTab('noMethod')
} catch (err) {
assert.strictEqual(err.message, 'No method named "noMethod"')
} catch (error) {
assert.strictEqual(error.message, 'No method named "noMethod"')
}
})
@@ -96,7 +96,7 @@ $(function () {
QUnit.test('should activate element by tab id in nav list', function (assert) {
assert.expect(2)
var tabsHTML = '<nav class="nav">' +
var tabsHTML = '<nav class="nav">' +
'<a href="#home">Home</a>' +
'<a href="#profile">Profile</a>' +
'</nav>'
@@ -112,7 +112,7 @@ $(function () {
QUnit.test('should activate element by tab id in list group', function (assert) {
assert.expect(2)
var tabsHTML = '<div class="list-group">' +
var tabsHTML = '<div class="list-group">' +
'<a href="#home">Home</a>' +
'<a href="#profile">Profile</a>' +
'</div>'
+2 -3
View File
@@ -41,8 +41,8 @@ $(function () {
try {
$el.bootstrapToast('noMethod')
} catch (err) {
assert.strictEqual(err.message, 'No method named "noMethod"')
} catch (error) {
assert.strictEqual(error.message, 'No method named "noMethod"')
}
})
@@ -208,7 +208,6 @@ $(function () {
.bootstrapToast('show')
})
QUnit.test('should close toast when close element with data-dismiss attribute is set', function (assert) {
assert.expect(2)
var done = assert.async()
+7 -7
View File
@@ -1,7 +1,7 @@
$(function () {
'use strict'
var Tooltip = typeof window.bootstrap !== 'undefined' ? window.bootstrap.Tooltip : window.Tooltip
var Tooltip = typeof window.bootstrap === 'undefined' ? window.Tooltip : window.bootstrap.Tooltip
QUnit.module('tooltip plugin')
@@ -34,8 +34,8 @@ $(function () {
$el.bootstrapTooltip()
try {
$el.bootstrapTooltip('noMethod')
} catch (err) {
assert.strictEqual(err.message, 'No method named "noMethod"')
} catch (error) {
assert.strictEqual(error.message, 'No method named "noMethod"')
}
})
@@ -231,8 +231,8 @@ $(function () {
try {
$('<div title="tooltip title" style="display: none"/>').bootstrapTooltip('show')
} catch (err) {
assert.strictEqual(err.message, 'Please use show on visible elements')
} catch (error) {
assert.strictEqual(error.message, 'Please use show on visible elements')
done()
}
})
@@ -336,7 +336,7 @@ $(function () {
assert.expect(3)
var $tooltip = $('<div/>')
.bootstrapTooltip()
.on('click.foo', function () {}) // eslint-disable-line no-empty-function
.on('click.foo', function () {}) // eslint-disable-line no-empty-function
assert.ok(Tooltip._getInstance($tooltip[0]), 'tooltip has data')
@@ -557,7 +557,7 @@ $(function () {
try {
$tooltip.bootstrapTooltip('show')
} catch (err) {
} catch (error) {
passed = false
}
+5 -5
View File
@@ -44,8 +44,8 @@ $(function () {
try {
Util.typeCheckConfig(namePlugin, config, defaultType)
} catch (err) {
assert.strictEqual(err.message, 'COLLAPSE: Option "parent" provided type "number" but expected type "(string|element)".')
} catch (error) {
assert.strictEqual(error.message, 'COLLAPSE: Option "parent" provided type "number" but expected type "(string|element)".')
}
})
@@ -139,9 +139,7 @@ $(function () {
assert.expect(1)
var $div = $('<div id="test"></div>').appendTo($('#qunit-fixture'))
if (!document.documentElement.attachShadow) {
assert.equal(null, Util.findShadowRoot($div[0]))
} else {
if (document.documentElement.attachShadow) {
var sandbox = sinon.createSandbox()
sandbox.replace(document.documentElement, 'attachShadow', function () {
@@ -151,6 +149,8 @@ $(function () {
assert.equal(null, Util.findShadowRoot($div[0]))
sandbox.restore()
} else {
assert.equal(null, Util.findShadowRoot($div[0]))
}
})