mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
Alert: add a couple more tests (#35419)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
parent
3129ff075b
commit
1692fc6b4b
1 changed files with 28 additions and 0 deletions
|
@ -179,6 +179,34 @@ describe('Alert', () => {
|
||||||
expect(Alert.getInstance(alertEl)).not.toBeNull()
|
expect(Alert.getInstance(alertEl)).not.toBeNull()
|
||||||
expect(fixtureEl.querySelector('.alert')).not.toBeNull()
|
expect(fixtureEl.querySelector('.alert')).not.toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should throw an error on undefined method', () => {
|
||||||
|
fixtureEl.innerHTML = '<div></div>'
|
||||||
|
|
||||||
|
const div = fixtureEl.querySelector('div')
|
||||||
|
const action = 'undefinedMethod'
|
||||||
|
|
||||||
|
jQueryMock.fn.alert = Alert.jQueryInterface
|
||||||
|
jQueryMock.elements = [div]
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
jQueryMock.fn.alert.call(jQueryMock, action)
|
||||||
|
}).toThrowError(TypeError, `No method named "${action}"`)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should throw an error on protected method', () => {
|
||||||
|
fixtureEl.innerHTML = '<div></div>'
|
||||||
|
|
||||||
|
const div = fixtureEl.querySelector('div')
|
||||||
|
const action = '_getConfig'
|
||||||
|
|
||||||
|
jQueryMock.fn.alert = Alert.jQueryInterface
|
||||||
|
jQueryMock.elements = [div]
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
jQueryMock.fn.alert.call(jQueryMock, action)
|
||||||
|
}).toThrowError(TypeError, `No method named "${action}"`)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('getInstance', () => {
|
describe('getInstance', () => {
|
||||||
|
|
Loading…
Reference in a new issue