mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-20 20:00:36 +03:00
Extract Component config functionality to a separate class (#33872)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
@@ -223,53 +223,6 @@ describe('Util', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('typeCheckConfig', () => {
|
||||
const namePlugin = 'collapse'
|
||||
|
||||
it('should check type of the config object', () => {
|
||||
const defaultType = {
|
||||
toggle: 'boolean',
|
||||
parent: '(string|element)'
|
||||
}
|
||||
const config = {
|
||||
toggle: true,
|
||||
parent: 777
|
||||
}
|
||||
|
||||
expect(() => {
|
||||
Util.typeCheckConfig(namePlugin, config, defaultType)
|
||||
}).toThrowError(TypeError, 'COLLAPSE: Option "parent" provided type "number" but expected type "(string|element)".')
|
||||
})
|
||||
|
||||
it('should return null stringified when null is passed', () => {
|
||||
const defaultType = {
|
||||
toggle: 'boolean',
|
||||
parent: '(null|element)'
|
||||
}
|
||||
const config = {
|
||||
toggle: true,
|
||||
parent: null
|
||||
}
|
||||
|
||||
Util.typeCheckConfig(namePlugin, config, defaultType)
|
||||
expect().nothing()
|
||||
})
|
||||
|
||||
it('should return undefined stringified when undefined is passed', () => {
|
||||
const defaultType = {
|
||||
toggle: 'boolean',
|
||||
parent: '(undefined|element)'
|
||||
}
|
||||
const config = {
|
||||
toggle: true,
|
||||
parent: undefined
|
||||
}
|
||||
|
||||
Util.typeCheckConfig(namePlugin, config, defaultType)
|
||||
expect().nothing()
|
||||
})
|
||||
})
|
||||
|
||||
describe('isVisible', () => {
|
||||
it('should return false if the element is not defined', () => {
|
||||
expect(Util.isVisible(null)).toBeFalse()
|
||||
|
||||
Reference in New Issue
Block a user