if (typeof config === 'number') {
data.to(config)
-
- } else if (action) {
+ } else if (typeof action === 'string') {
+ if (data[action] === undefined) {
+ throw new Error(`No method named "${action}"`)
+ }
data[action]()
-
} else if (_config.interval) {
data.pause()
data.cycle()
}
if (typeof config === 'string') {
+ if (data[config] === undefined) {
+ throw new Error(`No method named "${config}"`)
+ }
data[config]()
}
})
}
if (typeof config === 'string') {
+ if (data[config] === undefined) {
+ throw new Error(`No method named "${config}"`)
+ }
data[config].call(this)
}
})
}
if (typeof config === 'string') {
+ if (data[config] === undefined) {
+ throw new Error(`No method named "${config}"`)
+ }
data[config](relatedTarget)
-
} else if (_config.show) {
data.show(relatedTarget)
}
}
if (typeof config === 'string') {
+ if (data[config] === undefined) {
+ throw new Error(`No method named "${config}"`)
+ }
data[config]()
}
})
}
if (typeof config === 'string') {
+ if (data[config] === undefined) {
+ throw new Error(`No method named "${config}"`)
+ }
data[config]()
}
})
}
if (typeof config === 'string') {
+ if (data[config] === undefined) {
+ throw new Error(`No method named "${config}"`)
+ }
data[config]()
}
})
}
if (typeof config === 'string') {
+ if (data[config] === undefined) {
+ throw new Error(`No method named "${config}"`)
+ }
data[config]()
}
})
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/>')
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/>')
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/>')
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"/>')
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/>')
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/>')
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/>')
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/>')