2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-02 16:04:07 +03:00

remove underscore for static methods

This commit is contained in:
Johann-S
2019-07-28 15:24:46 +02:00
parent 144220f0c5
commit dcba526775
32 changed files with 215 additions and 215 deletions
+4 -4
View File
@@ -122,7 +122,7 @@ class Button {
// Static
static _jQueryInterface(config) {
static jQueryInterface(config) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
@@ -136,7 +136,7 @@ class Button {
})
}
static _getInstance(element) {
static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -188,12 +188,12 @@ EventHandler.on(document, Event.BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, even
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
$.fn[NAME] = Button._jQueryInterface
$.fn[NAME] = Button.jQueryInterface
$.fn[NAME].Constructor = Button
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Button._jQueryInterface
return Button.jQueryInterface
}
}
+8 -8
View File
@@ -236,15 +236,15 @@ describe('Button', () => {
const btnEl = fixtureEl.querySelector('.btn')
const button = new Button(btnEl)
expect(Button._getInstance(btnEl)).toBeDefined()
expect(Button.getInstance(btnEl)).toBeDefined()
button.dispose()
expect(Button._getInstance(btnEl)).toBeNull()
expect(Button.getInstance(btnEl)).toBeNull()
})
})
describe('_jQueryInterface', () => {
describe('jQueryInterface', () => {
it('should handle config passed and toggle existing button', () => {
fixtureEl.innerHTML = '<button class="btn" data-toggle="button"></button>'
@@ -253,7 +253,7 @@ describe('Button', () => {
spyOn(button, 'toggle')
jQueryMock.fn.button = Button._jQueryInterface
jQueryMock.fn.button = Button.jQueryInterface
jQueryMock.elements = [btnEl]
jQueryMock.fn.button.call(jQueryMock, 'toggle')
@@ -266,12 +266,12 @@ describe('Button', () => {
const btnEl = fixtureEl.querySelector('.btn')
jQueryMock.fn.button = Button._jQueryInterface
jQueryMock.fn.button = Button.jQueryInterface
jQueryMock.elements = [btnEl]
jQueryMock.fn.button.call(jQueryMock, 'toggle')
expect(Button._getInstance(btnEl)).toBeDefined()
expect(Button.getInstance(btnEl)).toBeDefined()
expect(btnEl.classList.contains('active')).toEqual(true)
})
@@ -280,12 +280,12 @@ describe('Button', () => {
const btnEl = fixtureEl.querySelector('.btn')
jQueryMock.fn.button = Button._jQueryInterface
jQueryMock.fn.button = Button.jQueryInterface
jQueryMock.elements = [btnEl]
jQueryMock.fn.button.call(jQueryMock)
expect(Button._getInstance(btnEl)).toBeDefined()
expect(Button.getInstance(btnEl)).toBeDefined()
expect(btnEl.classList.contains('active')).toEqual(false)
})
})