aboutsummaryrefslogtreecommitdiff
path: root/js/src/scrollspy
diff options
context:
space:
mode:
authorJohann-S <[email protected]>2019-07-28 15:24:46 +0200
committerJohann-S <[email protected]>2019-07-29 11:34:12 +0200
commitdcba52677556bedb04a07825c2023e0beeea6f1e (patch)
treeddf5bbf334408536c609f2ded245e119c1a9de17 /js/src/scrollspy
parent144220f0c5777e07fb1832324d52a590bec363e2 (diff)
downloadbootstrap-dcba52677556bedb04a07825c2023e0beeea6f1e.tar.xz
bootstrap-dcba52677556bedb04a07825c2023e0beeea6f1e.zip
remove underscore for static methods
Diffstat (limited to 'js/src/scrollspy')
-rw-r--r--js/src/scrollspy/scrollspy.js8
-rw-r--r--js/src/scrollspy/scrollspy.spec.js22
2 files changed, 15 insertions, 15 deletions
diff --git a/js/src/scrollspy/scrollspy.js b/js/src/scrollspy/scrollspy.js
index 68c51f7d7..b3b87a3b2 100644
--- a/js/src/scrollspy/scrollspy.js
+++ b/js/src/scrollspy/scrollspy.js
@@ -301,7 +301,7 @@ class ScrollSpy {
// Static
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
const _config = typeof config === 'object' && config
@@ -320,7 +320,7 @@ class ScrollSpy {
})
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -344,11 +344,11 @@ EventHandler.on(window, Event.LOAD_DATA_API, () => {
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = ScrollSpy._jQueryInterface
+ $.fn[NAME] = ScrollSpy.jQueryInterface
$.fn[NAME].Constructor = ScrollSpy
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return ScrollSpy._jQueryInterface
+ return ScrollSpy.jQueryInterface
}
}
diff --git a/js/src/scrollspy/scrollspy.spec.js b/js/src/scrollspy/scrollspy.spec.js
index f9b6fd29e..a019a6d1a 100644
--- a/js/src/scrollspy/scrollspy.spec.js
+++ b/js/src/scrollspy/scrollspy.spec.js
@@ -571,18 +571,18 @@ describe('ScrollSpy', () => {
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should create a scrollspy', () => {
fixtureEl.innerHTML = '<div></div>'
const div = fixtureEl.querySelector('div')
- jQueryMock.fn.scrollspy = ScrollSpy._jQueryInterface
+ jQueryMock.fn.scrollspy = ScrollSpy.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.scrollspy.call(jQueryMock)
- expect(ScrollSpy._getInstance(div)).toBeDefined()
+ expect(ScrollSpy.getInstance(div)).toBeDefined()
})
it('should not re create a scrollspy', () => {
@@ -591,12 +591,12 @@ describe('ScrollSpy', () => {
const div = fixtureEl.querySelector('div')
const scrollSpy = new ScrollSpy(div)
- jQueryMock.fn.scrollspy = ScrollSpy._jQueryInterface
+ jQueryMock.fn.scrollspy = ScrollSpy.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.scrollspy.call(jQueryMock)
- expect(ScrollSpy._getInstance(div)).toEqual(scrollSpy)
+ expect(ScrollSpy.getInstance(div)).toEqual(scrollSpy)
})
it('should call a scrollspy method', () => {
@@ -607,12 +607,12 @@ describe('ScrollSpy', () => {
spyOn(scrollSpy, 'refresh')
- jQueryMock.fn.scrollspy = ScrollSpy._jQueryInterface
+ jQueryMock.fn.scrollspy = ScrollSpy.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.scrollspy.call(jQueryMock, 'refresh')
- expect(ScrollSpy._getInstance(div)).toEqual(scrollSpy)
+ expect(ScrollSpy.getInstance(div)).toEqual(scrollSpy)
expect(scrollSpy.refresh).toHaveBeenCalled()
})
@@ -622,7 +622,7 @@ describe('ScrollSpy', () => {
const div = fixtureEl.querySelector('div')
const action = 'undefinedMethod'
- jQueryMock.fn.scrollspy = ScrollSpy._jQueryInterface
+ jQueryMock.fn.scrollspy = ScrollSpy.jQueryInterface
jQueryMock.elements = [div]
try {
@@ -633,9 +633,9 @@ describe('ScrollSpy', () => {
})
})
- describe('_getInstance', () => {
+ describe('getInstance', () => {
it('should return null if there is no instance', () => {
- expect(ScrollSpy._getInstance(fixtureEl)).toEqual(null)
+ expect(ScrollSpy.getInstance(fixtureEl)).toEqual(null)
})
})
@@ -647,7 +647,7 @@ describe('ScrollSpy', () => {
window.dispatchEvent(createEvent('load'))
- expect(ScrollSpy._getInstance(scrollSpyEl)).not.toBeNull()
+ expect(ScrollSpy.getInstance(scrollSpyEl)).not.toBeNull()
})
})
})