mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-18 03:11:19 +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:
@@ -20,6 +20,22 @@ describe('Tab', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('constructor', () => {
|
||||
it('should take care of element either passed as a CSS selector or DOM element', () => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<ul class="nav"><li><a href="#home" role="tab">Home</a></li></ul>',
|
||||
'<ul><li id="home"></li></ul>'
|
||||
].join('')
|
||||
|
||||
const tabEl = fixtureEl.querySelector('[href="#home"]')
|
||||
const tabBySelector = new Tab('[href="#home"]')
|
||||
const tabByElement = new Tab(tabEl)
|
||||
|
||||
expect(tabBySelector._element).toEqual(tabEl)
|
||||
expect(tabByElement._element).toEqual(tabEl)
|
||||
})
|
||||
})
|
||||
|
||||
describe('show', () => {
|
||||
it('should activate element by tab id (using buttons, the preferred semantic way)', done => {
|
||||
fixtureEl.innerHTML = [
|
||||
|
Reference in New Issue
Block a user