mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-08 06:36:33 +02:00
Carousel: move repeated code to a method
This commit is contained in:
@@ -851,12 +851,12 @@ describe('Carousel', () => {
|
||||
const carousel = new Carousel(carouselEl)
|
||||
|
||||
spyOn(carousel, 'cycle')
|
||||
spyOn(window, 'clearInterval')
|
||||
spyOn(carousel, '_clearInterval')
|
||||
|
||||
carousel.pause()
|
||||
|
||||
expect(carousel.cycle).toHaveBeenCalledWith(true)
|
||||
expect(window.clearInterval).toHaveBeenCalled()
|
||||
expect(carousel._clearInterval).toHaveBeenCalled()
|
||||
expect(carousel._isPaused).toBeTrue()
|
||||
})
|
||||
|
||||
@@ -877,12 +877,12 @@ describe('Carousel', () => {
|
||||
const carousel = new Carousel(carouselEl)
|
||||
|
||||
spyOn(carousel, 'cycle')
|
||||
spyOn(window, 'clearInterval')
|
||||
spyOn(carousel, '_clearInterval')
|
||||
|
||||
carousel.pause()
|
||||
|
||||
expect(carousel.cycle).not.toHaveBeenCalled()
|
||||
expect(window.clearInterval).toHaveBeenCalled()
|
||||
expect(carousel._clearInterval).toHaveBeenCalled()
|
||||
expect(carousel._isPaused).toBeTrue()
|
||||
})
|
||||
|
||||
@@ -903,11 +903,11 @@ describe('Carousel', () => {
|
||||
const carousel = new Carousel(carouselEl)
|
||||
const event = createEvent('mouseenter')
|
||||
|
||||
spyOn(window, 'clearInterval')
|
||||
spyOn(carousel, '_clearInterval')
|
||||
|
||||
carousel.pause(event)
|
||||
|
||||
expect(window.clearInterval).toHaveBeenCalled()
|
||||
expect(carousel._clearInterval).toHaveBeenCalled()
|
||||
expect(carousel._isPaused).toBeFalse()
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user