mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 00:54:04 +02:00
Carousel: refactor _slide
method te accept only order as first argument
This commit is contained in:
@@ -378,7 +378,7 @@ describe('Carousel', () => {
|
||||
|
||||
carouselEl.addEventListener('slid.bs.carousel', event => {
|
||||
expect(item).toHaveClass('active')
|
||||
expect(carousel._slide).toHaveBeenCalledWith('right')
|
||||
expect(carousel._slide).toHaveBeenCalledWith('prev')
|
||||
expect(event.direction).toEqual('right')
|
||||
stylesCarousel.remove()
|
||||
delete document.documentElement.ontouchstart
|
||||
@@ -425,7 +425,7 @@ describe('Carousel', () => {
|
||||
|
||||
carouselEl.addEventListener('slid.bs.carousel', event => {
|
||||
expect(item).not.toHaveClass('active')
|
||||
expect(carousel._slide).toHaveBeenCalledWith('left')
|
||||
expect(carousel._slide).toHaveBeenCalledWith('next')
|
||||
expect(event.direction).toEqual('left')
|
||||
stylesCarousel.remove()
|
||||
delete document.documentElement.ontouchstart
|
||||
@@ -467,7 +467,7 @@ describe('Carousel', () => {
|
||||
|
||||
carouselEl.addEventListener('slid.bs.carousel', event => {
|
||||
expect(item).toHaveClass('active')
|
||||
expect(carousel._slide).toHaveBeenCalledWith('right')
|
||||
expect(carousel._slide).toHaveBeenCalledWith('prev')
|
||||
expect(event.direction).toEqual('right')
|
||||
delete document.documentElement.ontouchstart
|
||||
restorePointerEvents()
|
||||
@@ -508,7 +508,7 @@ describe('Carousel', () => {
|
||||
|
||||
carouselEl.addEventListener('slid.bs.carousel', event => {
|
||||
expect(item).not.toHaveClass('active')
|
||||
expect(carousel._slide).toHaveBeenCalledWith('left')
|
||||
expect(carousel._slide).toHaveBeenCalledWith('next')
|
||||
expect(event.direction).toEqual('left')
|
||||
delete document.documentElement.ontouchstart
|
||||
restorePointerEvents()
|
||||
@@ -1231,16 +1231,14 @@ describe('Carousel', () => {
|
||||
|
||||
const carouselEl = fixtureEl.querySelector('div')
|
||||
const carousel = new Carousel(carouselEl, {})
|
||||
const spy = spyOn(carousel, '_directionToOrder').and.callThrough()
|
||||
const spy2 = spyOn(carousel, '_orderToDirection').and.callThrough()
|
||||
|
||||
carousel._slide('left')
|
||||
expect(spy).toHaveBeenCalledWith('left')
|
||||
expect(spy2).toHaveBeenCalledWith('next')
|
||||
const spy = spyOn(carousel, '_orderToDirection').and.callThrough()
|
||||
|
||||
carousel._slide('right')
|
||||
expect(spy).toHaveBeenCalledWith('right')
|
||||
expect(spy2).toHaveBeenCalledWith('prev')
|
||||
carousel._slide(carousel._directionToOrder('left'))
|
||||
expect(spy).toHaveBeenCalledWith('next')
|
||||
|
||||
carousel._slide(carousel._directionToOrder('right'))
|
||||
expect(spy).toHaveBeenCalledWith('prev')
|
||||
})
|
||||
|
||||
it('"_slide" has to call "_directionToOrder" and "_orderToDirection" when rtl=true', () => {
|
||||
@@ -1249,16 +1247,13 @@ describe('Carousel', () => {
|
||||
|
||||
const carouselEl = fixtureEl.querySelector('div')
|
||||
const carousel = new Carousel(carouselEl, {})
|
||||
const spy = spyOn(carousel, '_directionToOrder').and.callThrough()
|
||||
const spy2 = spyOn(carousel, '_orderToDirection').and.callThrough()
|
||||
const spy = spyOn(carousel, '_orderToDirection').and.callThrough()
|
||||
|
||||
carousel._slide('left')
|
||||
expect(spy).toHaveBeenCalledWith('left')
|
||||
expect(spy2).toHaveBeenCalledWith('prev')
|
||||
carousel._slide(carousel._directionToOrder('left'))
|
||||
expect(spy).toHaveBeenCalledWith('prev')
|
||||
|
||||
carousel._slide('right')
|
||||
expect(spy).toHaveBeenCalledWith('right')
|
||||
expect(spy2).toHaveBeenCalledWith('next')
|
||||
carousel._slide(carousel._directionToOrder('right'))
|
||||
expect(spy).toHaveBeenCalledWith('next')
|
||||
|
||||
document.documentElement.dir = 'ltl'
|
||||
})
|
||||
|
Reference in New Issue
Block a user