mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-12 08:34:08 +02:00
Allow constructors to accept a CSS selector (#32245)
Co-authored-by: XhmikosR <xhmikosr@gmail.com> Co-authored-by: Mark Otto <otto@github.com>
This commit is contained in:
@@ -34,6 +34,17 @@ describe('Collapse', () => {
|
||||
})
|
||||
|
||||
describe('constructor', () => {
|
||||
it('should take care of element either passed as a CSS selector or DOM element', () => {
|
||||
fixtureEl.innerHTML = '<div class="my-collapse"></div>'
|
||||
|
||||
const collapseEl = fixtureEl.querySelector('div.my-collapse')
|
||||
const collapseBySelector = new Collapse('div.my-collapse')
|
||||
const collapseByElement = new Collapse(collapseEl)
|
||||
|
||||
expect(collapseBySelector._element).toEqual(collapseEl)
|
||||
expect(collapseByElement._element).toEqual(collapseEl)
|
||||
})
|
||||
|
||||
it('should allow jquery object in parent config', () => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<div class="my-collapse">',
|
||||
|
Reference in New Issue
Block a user