mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-12 00:24:03 +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:
@@ -54,6 +54,17 @@ describe('ScrollSpy', () => {
|
||||
})
|
||||
|
||||
describe('constructor', () => {
|
||||
it('should take care of element either passed as a CSS selector or DOM element', () => {
|
||||
fixtureEl.innerHTML = '<nav id="navigation"></nav><div class="content"></div>'
|
||||
|
||||
const sSpyEl = fixtureEl.querySelector('#navigation')
|
||||
const sSpyBySelector = new ScrollSpy('#navigation')
|
||||
const sSpyByElement = new ScrollSpy(sSpyEl)
|
||||
|
||||
expect(sSpyBySelector._element).toEqual(sSpyEl)
|
||||
expect(sSpyByElement._element).toEqual(sSpyEl)
|
||||
})
|
||||
|
||||
it('should generate an id when there is not one', () => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<nav></nav>',
|
||||
|
Reference in New Issue
Block a user