mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-09 23:26:40 +02:00
Accept argument of different types in the getInstance
method (#34333)
This commit is contained in:
@@ -104,6 +104,20 @@ describe('Base Component', () => {
|
||||
expect(DummyClass.getInstance(element)).toBeInstanceOf(DummyClass)
|
||||
})
|
||||
|
||||
it('should accept element, either passed as a CSS selector, jQuery element, or DOM element', () => {
|
||||
createInstance()
|
||||
|
||||
expect(DummyClass.getInstance('#foo')).toEqual(instance)
|
||||
expect(DummyClass.getInstance(element)).toEqual(instance)
|
||||
|
||||
const fakejQueryObject = {
|
||||
0: element,
|
||||
jquery: 'foo'
|
||||
}
|
||||
|
||||
expect(DummyClass.getInstance(fakejQueryObject)).toEqual(instance)
|
||||
})
|
||||
|
||||
it('should return null when there is no instance', () => {
|
||||
fixtureEl.innerHTML = '<div></div>'
|
||||
|
||||
|
Reference in New Issue
Block a user