mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-07 04:54:24 +01:00
Carousel: rename private property
This commit is contained in:
parent
ec0e1c220e
commit
3673933fe7
@ -97,7 +97,7 @@ class Carousel extends BaseComponent {
|
|||||||
|
|
||||||
this._interval = null
|
this._interval = null
|
||||||
this._activeElement = null
|
this._activeElement = null
|
||||||
this._isPaused = false
|
this._stayPaused = false
|
||||||
this._isSliding = false
|
this._isSliding = false
|
||||||
this.touchTimeout = null
|
this.touchTimeout = null
|
||||||
this._swipeHelper = null
|
this._swipeHelper = null
|
||||||
@ -139,7 +139,7 @@ class Carousel extends BaseComponent {
|
|||||||
|
|
||||||
pause(event) {
|
pause(event) {
|
||||||
if (!event) {
|
if (!event) {
|
||||||
this._isPaused = true
|
this._stayPaused = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
|
if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
|
||||||
@ -152,11 +152,11 @@ class Carousel extends BaseComponent {
|
|||||||
|
|
||||||
cycle(event) {
|
cycle(event) {
|
||||||
if (!event) {
|
if (!event) {
|
||||||
this._isPaused = false
|
this._stayPaused = false
|
||||||
}
|
}
|
||||||
|
|
||||||
this._clearInterval()
|
this._clearInterval()
|
||||||
if (this._config.interval && !this._isPaused) {
|
if (this._config.interval && !this._stayPaused) {
|
||||||
this._updateInterval()
|
this._updateInterval()
|
||||||
|
|
||||||
this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)
|
this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)
|
||||||
|
@ -891,7 +891,7 @@ describe('Carousel', () => {
|
|||||||
|
|
||||||
expect(carousel.cycle).toHaveBeenCalledWith(true)
|
expect(carousel.cycle).toHaveBeenCalledWith(true)
|
||||||
expect(carousel._clearInterval).toHaveBeenCalled()
|
expect(carousel._clearInterval).toHaveBeenCalled()
|
||||||
expect(carousel._isPaused).toBeTrue()
|
expect(carousel._stayPaused).toBeTrue()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not call cycle if nothing is in transition', () => {
|
it('should not call cycle if nothing is in transition', () => {
|
||||||
@ -917,7 +917,7 @@ describe('Carousel', () => {
|
|||||||
|
|
||||||
expect(carousel.cycle).not.toHaveBeenCalled()
|
expect(carousel.cycle).not.toHaveBeenCalled()
|
||||||
expect(carousel._clearInterval).toHaveBeenCalled()
|
expect(carousel._clearInterval).toHaveBeenCalled()
|
||||||
expect(carousel._isPaused).toBeTrue()
|
expect(carousel._stayPaused).toBeTrue()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not set is paused at true if an event is passed', () => {
|
it('should not set is paused at true if an event is passed', () => {
|
||||||
@ -942,7 +942,7 @@ describe('Carousel', () => {
|
|||||||
carousel.pause(event)
|
carousel.pause(event)
|
||||||
|
|
||||||
expect(carousel._clearInterval).toHaveBeenCalled()
|
expect(carousel._clearInterval).toHaveBeenCalled()
|
||||||
expect(carousel._isPaused).toBeFalse()
|
expect(carousel._stayPaused).toBeFalse()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -988,7 +988,7 @@ describe('Carousel', () => {
|
|||||||
|
|
||||||
spyOn(window, 'setInterval').and.callThrough()
|
spyOn(window, 'setInterval').and.callThrough()
|
||||||
|
|
||||||
carousel._isPaused = true
|
carousel._stayPaused = true
|
||||||
carousel.cycle(true)
|
carousel.cycle(true)
|
||||||
|
|
||||||
expect(window.setInterval).not.toHaveBeenCalled()
|
expect(window.setInterval).not.toHaveBeenCalled()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user