diff options
| author | Johann-S <[email protected]> | 2019-07-28 15:24:46 +0200 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2019-07-29 11:34:12 +0200 |
| commit | dcba52677556bedb04a07825c2023e0beeea6f1e (patch) | |
| tree | ddf5bbf334408536c609f2ded245e119c1a9de17 /js/src/carousel | |
| parent | 144220f0c5777e07fb1832324d52a590bec363e2 (diff) | |
| download | bootstrap-dcba52677556bedb04a07825c2023e0beeea6f1e.tar.xz bootstrap-dcba52677556bedb04a07825c2023e0beeea6f1e.zip | |
remove underscore for static methods
Diffstat (limited to 'js/src/carousel')
| -rw-r--r-- | js/src/carousel/carousel.js | 20 | ||||
| -rw-r--r-- | js/src/carousel/carousel.spec.js | 16 |
2 files changed, 18 insertions, 18 deletions
diff --git a/js/src/carousel/carousel.js b/js/src/carousel/carousel.js index af4229f07..0bac655ea 100644 --- a/js/src/carousel/carousel.js +++ b/js/src/carousel/carousel.js @@ -528,7 +528,7 @@ class Carousel { // Static - static _carouselInterface(element, config) { + static carouselInterface(element, config) { let data = Data.getData(element, DATA_KEY) let _config = { ...Default, @@ -562,13 +562,13 @@ class Carousel { } } - static _jQueryInterface(config) { + static jQueryInterface(config) { return this.each(function () { - Carousel._carouselInterface(this, config) + Carousel.carouselInterface(this, config) }) } - static _dataApiClickHandler(event) { + static dataApiClickHandler(event) { const target = getElementFromSelector(this) if (!target || !target.classList.contains(ClassName.CAROUSEL)) { @@ -585,7 +585,7 @@ class Carousel { config.interval = false } - Carousel._carouselInterface(target, config) + Carousel.carouselInterface(target, config) if (slideIndex) { Data.getData(target, DATA_KEY).to(slideIndex) @@ -594,7 +594,7 @@ class Carousel { event.preventDefault() } - static _getInstance(element) { + static getInstance(element) { return Data.getData(element, DATA_KEY) } } @@ -606,12 +606,12 @@ class Carousel { */ EventHandler - .on(document, Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler) + .on(document, Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel.dataApiClickHandler) EventHandler.on(window, Event.LOAD_DATA_API, () => { const carousels = makeArray(SelectorEngine.find(Selector.DATA_RIDE)) for (let i = 0, len = carousels.length; i < len; i++) { - Carousel._carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY)) + Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY)) } }) @@ -624,11 +624,11 @@ EventHandler.on(window, Event.LOAD_DATA_API, () => { /* istanbul ignore if */ if (typeof $ !== 'undefined') { const JQUERY_NO_CONFLICT = $.fn[NAME] - $.fn[NAME] = Carousel._jQueryInterface + $.fn[NAME] = Carousel.jQueryInterface $.fn[NAME].Constructor = Carousel $.fn[NAME].noConflict = () => { $.fn[NAME] = JQUERY_NO_CONFLICT - return Carousel._jQueryInterface + return Carousel.jQueryInterface } } diff --git a/js/src/carousel/carousel.spec.js b/js/src/carousel/carousel.spec.js index 38888e7c2..4c13b6d22 100644 --- a/js/src/carousel/carousel.spec.js +++ b/js/src/carousel/carousel.spec.js @@ -1037,18 +1037,18 @@ describe('Carousel', () => { }) }) - describe('_jQueryInterface', () => { + describe('jQueryInterface', () => { it('should create a carousel', () => { fixtureEl.innerHTML = '<div></div>' const div = fixtureEl.querySelector('div') - jQueryMock.fn.carousel = Carousel._jQueryInterface + jQueryMock.fn.carousel = Carousel.jQueryInterface jQueryMock.elements = [div] jQueryMock.fn.carousel.call(jQueryMock) - expect(Carousel._getInstance(div)).toBeDefined() + expect(Carousel.getInstance(div)).toBeDefined() }) it('should not re create a carousel', () => { @@ -1057,12 +1057,12 @@ describe('Carousel', () => { const div = fixtureEl.querySelector('div') const carousel = new Carousel(div) - jQueryMock.fn.carousel = Carousel._jQueryInterface + jQueryMock.fn.carousel = Carousel.jQueryInterface jQueryMock.elements = [div] jQueryMock.fn.carousel.call(jQueryMock) - expect(Carousel._getInstance(div)).toEqual(carousel) + expect(Carousel.getInstance(div)).toEqual(carousel) }) it('should call to if the config is a number', () => { @@ -1074,7 +1074,7 @@ describe('Carousel', () => { spyOn(carousel, 'to') - jQueryMock.fn.carousel = Carousel._jQueryInterface + jQueryMock.fn.carousel = Carousel.jQueryInterface jQueryMock.elements = [div] jQueryMock.fn.carousel.call(jQueryMock, slideTo) @@ -1088,7 +1088,7 @@ describe('Carousel', () => { const div = fixtureEl.querySelector('div') const action = 'undefinedMethod' - jQueryMock.fn.carousel = Carousel._jQueryInterface + jQueryMock.fn.carousel = Carousel.jQueryInterface jQueryMock.elements = [div] try { @@ -1108,7 +1108,7 @@ describe('Carousel', () => { window.dispatchEvent(loadEvent) - expect(Carousel._getInstance(carouselEl)).toBeDefined() + expect(Carousel.getInstance(carouselEl)).toBeDefined() }) it('should create carousel and go to the next slide on click', done => { |
