mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-14 09:34:36 +02:00
Add throw error for undefined method on plugins
This commit is contained in:
@@ -24,6 +24,18 @@ $(function () {
|
||||
assert.strictEqual($.fn.carousel, undefined, 'carousel was set back to undefined (orig value)')
|
||||
})
|
||||
|
||||
QUnit.test('should throw explicit error on undefined method', function (assert) {
|
||||
assert.expect(1)
|
||||
var $el = $('<div/>')
|
||||
$el.bootstrapCarousel()
|
||||
try {
|
||||
$el.bootstrapCarousel('noMethod')
|
||||
}
|
||||
catch (err) {
|
||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
||||
}
|
||||
})
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div/>')
|
||||
|
@@ -24,6 +24,18 @@ $(function () {
|
||||
assert.strictEqual($.fn.collapse, undefined, 'collapse was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
QUnit.test('should throw explicit error on undefined method', function (assert) {
|
||||
assert.expect(1)
|
||||
var $el = $('<div/>')
|
||||
$el.bootstrapCollapse()
|
||||
try {
|
||||
$el.bootstrapCollapse('noMethod')
|
||||
}
|
||||
catch (err) {
|
||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
||||
}
|
||||
})
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div/>')
|
||||
|
@@ -24,6 +24,18 @@ $(function () {
|
||||
assert.strictEqual($.fn.dropdown, undefined, 'dropdown was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
QUnit.test('should throw explicit error on undefined method', function (assert) {
|
||||
assert.expect(1)
|
||||
var $el = $('<div/>')
|
||||
$el.bootstrapDropdown()
|
||||
try {
|
||||
$el.bootstrapDropdown('noMethod')
|
||||
}
|
||||
catch (err) {
|
||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
||||
}
|
||||
})
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div/>')
|
||||
|
@@ -24,6 +24,18 @@ $(function () {
|
||||
assert.strictEqual($.fn.modal, undefined, 'modal was set back to undefined (orig value)')
|
||||
})
|
||||
|
||||
QUnit.test('should throw explicit error on undefined method', function (assert) {
|
||||
assert.expect(1)
|
||||
var $el = $('<div id="modal-test"/>')
|
||||
$el.bootstrapModal()
|
||||
try {
|
||||
$el.bootstrapModal('noMethod')
|
||||
}
|
||||
catch (err) {
|
||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
||||
}
|
||||
})
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div id="modal-test"/>')
|
||||
|
@@ -25,6 +25,18 @@ $(function () {
|
||||
assert.strictEqual($.fn.popover, undefined, 'popover was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
QUnit.test('should throw explicit error on undefined method', function (assert) {
|
||||
assert.expect(1)
|
||||
var $el = $('<div/>')
|
||||
$el.bootstrapPopover()
|
||||
try {
|
||||
$el.bootstrapPopover('noMethod')
|
||||
}
|
||||
catch (err) {
|
||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
||||
}
|
||||
})
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div/>')
|
||||
|
@@ -24,6 +24,18 @@ $(function () {
|
||||
assert.strictEqual($.fn.scrollspy, undefined, 'scrollspy was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
QUnit.test('should throw explicit error on undefined method', function (assert) {
|
||||
assert.expect(1)
|
||||
var $el = $('<div/>')
|
||||
$el.bootstrapScrollspy()
|
||||
try {
|
||||
$el.bootstrapScrollspy('noMethod')
|
||||
}
|
||||
catch (err) {
|
||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
||||
}
|
||||
})
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div/>')
|
||||
|
@@ -24,6 +24,18 @@ $(function () {
|
||||
assert.strictEqual($.fn.tab, undefined, 'tab was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
QUnit.test('should throw explicit error on undefined method', function (assert) {
|
||||
assert.expect(1)
|
||||
var $el = $('<div/>')
|
||||
$el.bootstrapTab()
|
||||
try {
|
||||
$el.bootstrapTab('noMethod')
|
||||
}
|
||||
catch (err) {
|
||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
||||
}
|
||||
})
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div/>')
|
||||
|
@@ -25,6 +25,18 @@ $(function () {
|
||||
assert.strictEqual($.fn.tooltip, undefined, 'tooltip was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
QUnit.test('should throw explicit error on undefined method', function (assert) {
|
||||
assert.expect(1)
|
||||
var $el = $('<div/>')
|
||||
$el.bootstrapTooltip()
|
||||
try {
|
||||
$el.bootstrapTooltip('noMethod')
|
||||
}
|
||||
catch (err) {
|
||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
||||
}
|
||||
})
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div/>')
|
||||
|
Reference in New Issue
Block a user