Skip to content

Commit 16b49a4

Browse files
authored
chore(refactor): unify event variable names (bootstrap-vue#6356)
1 parent f5ca62f commit 16b49a4

File tree

14 files changed

+64
-64
lines changed

14 files changed

+64
-64
lines changed

src/components/collapse/collapse.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ export const BCollapse = /*#__PURE__*/ Vue.extend({
102102
mounted() {
103103
this.show = this[MODEL_PROP_NAME]
104104
// Listen for toggle events to open/close us
105-
this.listenOnRoot(ROOT_ACTION_EVENT_NAME_TOGGLE, this.handleToggleEvt)
105+
this.listenOnRoot(ROOT_ACTION_EVENT_NAME_TOGGLE, this.handleToggleEvent)
106106
// Listen to other collapses for accordion events
107-
this.listenOnRoot(ROOT_EVENT_NAME_ACCORDION, this.handleAccordionEvt)
107+
this.listenOnRoot(ROOT_EVENT_NAME_ACCORDION, this.handleAccordionEvent)
108108
if (this.isNav) {
109109
// Set up handlers
110110
this.setWindowEvents(true)
@@ -219,12 +219,12 @@ export const BCollapse = /*#__PURE__*/ Vue.extend({
219219
this.show = false
220220
}
221221
},
222-
handleToggleEvt(id) {
222+
handleToggleEvent(id) {
223223
if (id === this.safeId()) {
224224
this.toggle()
225225
}
226226
},
227-
handleAccordionEvt(openedId, openAccordion) {
227+
handleAccordionEvent(openedId, openAccordion) {
228228
const { accordion, show } = this
229229
if (!accordion || accordion !== openAccordion) {
230230
return

src/components/modal/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,9 @@ To prevent `<b-modal>` from closing (for example when validation fails). you can
292292
this.name = ''
293293
this.nameState = null
294294
},
295-
handleOk(bvModalEvt) {
295+
handleOk(bvModalEvent) {
296296
// Prevent modal from closing
297-
bvModalEvt.preventDefault()
297+
bvModalEvent.preventDefault()
298298
// Trigger submit handler
299299
this.handleSubmit()
300300
},

src/components/modal/helpers/bv-modal.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ const plugin = Vue => {
147147
reject(new Error('BootstrapVue MsgBox destroyed before resolve'))
148148
}
149149
})
150-
msgBox.$on(EVENT_NAME_HIDE, bvModalEvt => {
151-
if (!bvModalEvt.defaultPrevented) {
152-
const result = resolver(bvModalEvt)
150+
msgBox.$on(EVENT_NAME_HIDE, bvModalEvent => {
151+
if (!bvModalEvent.defaultPrevented) {
152+
const result = resolver(bvModalEvent)
153153
// If resolver didn't cancel hide, we resolve
154-
if (!bvModalEvt.defaultPrevented) {
154+
if (!bvModalEvent.defaultPrevented) {
155155
resolved = true
156156
resolve(result)
157157
}
@@ -240,8 +240,8 @@ const plugin = Vue => {
240240
cancelDisabled: false,
241241
hideFooter: false
242242
}
243-
return makeMsgBox(this._vm, message, props, bvModalEvt => {
244-
const trigger = bvModalEvt.trigger
243+
return makeMsgBox(this._vm, message, props, bvModalEvent => {
244+
const trigger = bvModalEvent.trigger
245245
return trigger === 'ok' ? true : trigger === 'cancel' ? false : null
246246
})
247247
}

src/components/modal/modal.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,12 @@ export const BModal = /*#__PURE__*/ Vue.extend({
434434
this.isOpening = true
435435
// Set the element to return focus to when closed
436436
this.$_returnFocus = this.$_returnFocus || this.getActiveElement()
437-
const showEvt = this.buildEvent(EVENT_NAME_SHOW, {
437+
const showEvent = this.buildEvent(EVENT_NAME_SHOW, {
438438
cancelable: true
439439
})
440-
this.emitEvent(showEvt)
440+
this.emitEvent(showEvent)
441441
// Don't show if canceled
442-
if (showEvt.defaultPrevented || this.isVisible) {
442+
if (showEvent.defaultPrevented || this.isVisible) {
443443
this.isOpening = false
444444
// Ensure the v-model reflects the current state
445445
this.updateModel(false)
@@ -455,21 +455,21 @@ export const BModal = /*#__PURE__*/ Vue.extend({
455455
return
456456
}
457457
this.isClosing = true
458-
const hideEvt = this.buildEvent(EVENT_NAME_HIDE, {
458+
const hideEvent = this.buildEvent(EVENT_NAME_HIDE, {
459459
cancelable: trigger !== TRIGGER_FORCE,
460460
trigger: trigger || null
461461
})
462462
// We emit specific event for one of the three built-in buttons
463463
if (trigger === BUTTON_OK) {
464-
this.$emit(EVENT_NAME_OK, hideEvt)
464+
this.$emit(EVENT_NAME_OK, hideEvent)
465465
} else if (trigger === BUTTON_CANCEL) {
466-
this.$emit(EVENT_NAME_CANCEL, hideEvt)
466+
this.$emit(EVENT_NAME_CANCEL, hideEvent)
467467
} else if (trigger === BUTTON_CLOSE) {
468-
this.$emit(EVENT_NAME_CLOSE, hideEvt)
468+
this.$emit(EVENT_NAME_CLOSE, hideEvent)
469469
}
470-
this.emitEvent(hideEvt)
470+
this.emitEvent(hideEvent)
471471
// Hide if not canceled
472-
if (hideEvt.defaultPrevented || !this.isVisible) {
472+
if (hideEvent.defaultPrevented || !this.isVisible) {
473473
this.isClosing = false
474474
// Ensure v-model reflects current state
475475
this.updateModel(true)

src/components/navbar/navbar-toggle.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export const BNavbarToggle = /*#__PURE__*/ Vue.extend({
4141
}
4242
},
4343
created() {
44-
this.listenOnRoot(ROOT_EVENT_NAME_STATE, this.handleStateEvt)
45-
this.listenOnRoot(ROOT_EVENT_NAME_SYNC_STATE, this.handleStateEvt)
44+
this.listenOnRoot(ROOT_EVENT_NAME_STATE, this.handleStateEvent)
45+
this.listenOnRoot(ROOT_EVENT_NAME_SYNC_STATE, this.handleStateEvent)
4646
},
4747
methods: {
4848
onClick(event) {
@@ -51,7 +51,7 @@ export const BNavbarToggle = /*#__PURE__*/ Vue.extend({
5151
this.$emit(EVENT_NAME_CLICK, event)
5252
}
5353
},
54-
handleStateEvt(id, state) {
54+
handleStateEvent(id, state) {
5555
// We listen for state events so that we can pass the
5656
// boolean expanded state to the default scoped slot
5757
if (id === this.target) {

src/components/pagination-nav/pagination-nav.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ export const BPaginationNav = /*#__PURE__*/ Vue.extend({
127127
const target = event.currentTarget || event.target
128128

129129
// Emit a user-cancelable `page-click` event
130-
const clickEvt = new BvEvent(EVENT_NAME_PAGE_CLICK, {
130+
const clickEvent = new BvEvent(EVENT_NAME_PAGE_CLICK, {
131131
cancelable: true,
132132
vueTarget: this,
133133
target
134134
})
135-
this.$emit(clickEvt.type, clickEvt, pageNumber)
136-
if (clickEvt.defaultPrevented) {
135+
this.$emit(clickEvent.type, clickEvent, pageNumber)
136+
if (clickEvent.defaultPrevented) {
137137
return
138138
}
139139

src/components/pagination/pagination.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ export const BPagination = /*#__PURE__*/ Vue.extend({
102102
const { target } = event
103103

104104
// Emit a user-cancelable `page-click` event
105-
const clickEvt = new BvEvent(EVENT_NAME_PAGE_CLICK, {
105+
const clickEvent = new BvEvent(EVENT_NAME_PAGE_CLICK, {
106106
cancelable: true,
107107
vueTarget: this,
108108
target
109109
})
110-
this.$emit(clickEvt.type, clickEvt, pageNumber)
111-
if (clickEvt.defaultPrevented) {
110+
this.$emit(clickEvent.type, clickEvent, pageNumber)
111+
if (clickEvent.defaultPrevented) {
112112
return
113113
}
114114

src/components/table/helpers/mixin-tbody-row.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ export const tbodyRowMixin = Vue.extend({
8282
// Row event handlers
8383
rowHovered(event) {
8484
// `mouseenter` handler (non-bubbling)
85-
// `this.tbodyRowEvtStopped` from tbody mixin
86-
if (!this.tbodyRowEvtStopped(event)) {
85+
// `this.tbodyRowEventStopped` from tbody mixin
86+
if (!this.tbodyRowEventStopped(event)) {
8787
// `this.emitTbodyRowEvent` from tbody mixin
8888
this.emitTbodyRowEvent(EVENT_NAME_ROW_HOVERED, event)
8989
}
9090
},
9191
rowUnhovered(event) {
9292
// `mouseleave` handler (non-bubbling)
93-
// `this.tbodyRowEvtStopped` from tbody mixin
94-
if (!this.tbodyRowEvtStopped(event)) {
93+
// `this.tbodyRowEventStopped` from tbody mixin
94+
if (!this.tbodyRowEventStopped(event)) {
9595
// `this.emitTbodyRowEvent` from tbody mixin
9696
this.emitTbodyRowEvent(EVENT_NAME_ROW_UNHOVERED, event)
9797
}

src/components/table/helpers/mixin-tbody.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ export const tbodyMixin = Vue.extend({
7979
}
8080
}
8181
},
82-
tbodyRowEvtStopped(event) {
82+
tbodyRowEventStopped(event) {
8383
return this.stopIfBusy && this.stopIfBusy(event)
8484
},
8585
// Delegated row event handlers
8686
onTbodyRowKeydown(event) {
8787
// Keyboard navigation and row click emulation
8888
const { target, keyCode } = event
8989
if (
90-
this.tbodyRowEvtStopped(event) ||
90+
this.tbodyRowEventStopped(event) ||
9191
target.tagName !== 'TR' ||
9292
!isActiveElement(target) ||
9393
target.tabIndex !== 0
@@ -126,23 +126,23 @@ export const tbodyMixin = Vue.extend({
126126
onTBodyRowClicked(event) {
127127
// Don't emit event when the table is busy, the user clicked
128128
// on a non-disabled control or is selecting text
129-
if (this.tbodyRowEvtStopped(event) || filterEvent(event) || textSelectionActive(this.$el)) {
129+
if (this.tbodyRowEventStopped(event) || filterEvent(event) || textSelectionActive(this.$el)) {
130130
return
131131
}
132132
this.emitTbodyRowEvent(EVENT_NAME_ROW_CLICKED, event)
133133
},
134134
onTbodyRowMiddleMouseRowClicked(event) {
135-
if (!this.tbodyRowEvtStopped(event) && event.which === 2) {
135+
if (!this.tbodyRowEventStopped(event) && event.which === 2) {
136136
this.emitTbodyRowEvent(EVENT_NAME_ROW_MIDDLE_CLICKED, event)
137137
}
138138
},
139139
onTbodyRowContextmenu(event) {
140-
if (!this.tbodyRowEvtStopped(event)) {
140+
if (!this.tbodyRowEventStopped(event)) {
141141
this.emitTbodyRowEvent(EVENT_NAME_ROW_CONTEXTMENU, event)
142142
}
143143
},
144144
onTbodyRowDblClicked(event) {
145-
if (!this.tbodyRowEvtStopped(event) && !filterEvent(event)) {
145+
if (!this.tbodyRowEventStopped(event) && !filterEvent(event)) {
146146
this.emitTbodyRowEvent(EVENT_NAME_ROW_DBLCLICKED, event)
147147
}
148148
},

src/components/tabs/tabs.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const BVTabButton = /*#__PURE__*/ Vue.extend({
8888
focus() {
8989
attemptFocus(this.$refs.link)
9090
},
91-
handleEvt(event) {
91+
handleEvent(event) {
9292
/* istanbul ignore next */
9393
if (this.tab.disabled) {
9494
return
@@ -124,7 +124,7 @@ const BVTabButton = /*#__PURE__*/ Vue.extend({
124124
}
125125
},
126126
render(h) {
127-
const { id, tabIndex, setSize, posInSet, controls, handleEvt } = this
127+
const { id, tabIndex, setSize, posInSet, controls, handleEvent } = this
128128
const {
129129
title,
130130
localActive,
@@ -160,8 +160,8 @@ const BVTabButton = /*#__PURE__*/ Vue.extend({
160160
'aria-controls': controls
161161
},
162162
on: {
163-
click: handleEvt,
164-
keydown: handleEvt
163+
click: handleEvent,
164+
keydown: handleEvent
165165
},
166166
ref: 'link'
167167
},

src/components/toast/toast.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ export const BToast = /*#__PURE__*/ Vue.extend({
210210
show() {
211211
if (!this.localShow) {
212212
this.ensureToaster()
213-
const showEvt = this.buildEvent(EVENT_NAME_SHOW)
214-
this.emitEvent(showEvt)
213+
const showEvent = this.buildEvent(EVENT_NAME_SHOW)
214+
this.emitEvent(showEvent)
215215
this.dismissStarted = this.resumeDismiss = 0
216216
this.order = Date.now() * (this.appendToast ? 1 : -1)
217217
this.isHiding = false
@@ -227,8 +227,8 @@ export const BToast = /*#__PURE__*/ Vue.extend({
227227
},
228228
hide() {
229229
if (this.localShow) {
230-
const hideEvt = this.buildEvent(EVENT_NAME_HIDE)
231-
this.emitEvent(hideEvt)
230+
const hideEvent = this.buildEvent(EVENT_NAME_HIDE)
231+
this.emitEvent(hideEvent)
232232
this.setHoverHandler(false)
233233
this.dismissStarted = this.resumeDismiss = 0
234234
this.clearDismissTimer()
@@ -321,8 +321,8 @@ export const BToast = /*#__PURE__*/ Vue.extend({
321321
},
322322
onAfterEnter() {
323323
this.isTransitioning = false
324-
const hiddenEvt = this.buildEvent(EVENT_NAME_SHOWN)
325-
this.emitEvent(hiddenEvt)
324+
const hiddenEvent = this.buildEvent(EVENT_NAME_SHOWN)
325+
this.emitEvent(hiddenEvent)
326326
this.startDismissTimer()
327327
this.setHoverHandler(true)
328328
},
@@ -333,8 +333,8 @@ export const BToast = /*#__PURE__*/ Vue.extend({
333333
this.isTransitioning = false
334334
this.order = 0
335335
this.resumeDismiss = this.dismissStarted = 0
336-
const hiddenEvt = this.buildEvent(EVENT_NAME_HIDDEN)
337-
this.emitEvent(hiddenEvt)
336+
const hiddenEvent = this.buildEvent(EVENT_NAME_HIDDEN)
337+
this.emitEvent(hiddenEvent)
338338
this.doRender = false
339339
},
340340
// Render helper for generating the toast

src/components/tooltip/helpers/bv-tooltip.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,11 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
439439
// In the process of showing
440440
this.localShow = true
441441
// Create a cancelable BvEvent
442-
const showEvt = this.buildEvent(EVENT_NAME_SHOW, { cancelable: true })
443-
this.emitEvent(showEvt)
442+
const showEvent = this.buildEvent(EVENT_NAME_SHOW, { cancelable: true })
443+
this.emitEvent(showEvent)
444444
// Don't show if event cancelled
445445
/* istanbul ignore if */
446-
if (showEvt.defaultPrevented) {
446+
if (showEvent.defaultPrevented) {
447447
// Destroy the template (if for some reason it was created)
448448
this.destroyTemplate()
449449
return
@@ -466,10 +466,10 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
466466

467467
// Emit cancelable BvEvent 'hide'
468468
// We disable cancelling if `force` is true
469-
const hideEvt = this.buildEvent(EVENT_NAME_HIDE, { cancelable: !force })
470-
this.emitEvent(hideEvt)
469+
const hideEvent = this.buildEvent(EVENT_NAME_HIDE, { cancelable: !force })
470+
this.emitEvent(hideEvent)
471471
/* istanbul ignore if: ignore for now */
472-
if (hideEvt.defaultPrevented) {
472+
if (hideEvent.defaultPrevented) {
473473
// Don't hide if event cancelled
474474
return
475475
}

src/mixins/click-out.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('utils/click-out', () => {
2727
localVue
2828
})
2929

30-
const clickEvt = new MouseEvent('click')
30+
const clickEvent = new MouseEvent('click')
3131

3232
expect(wrapper).toBeDefined()
3333
expect(count).toBe(0)
@@ -39,13 +39,13 @@ describe('utils/click-out', () => {
3939
expect(count).toBe(0)
4040
await wrapper.trigger('click')
4141
expect(count).toBe(0)
42-
document.dispatchEvent(clickEvt)
42+
document.dispatchEvent(clickEvent)
4343
await waitNT(wrapper.vm)
4444
expect(count).toBe(1)
4545

4646
// When `this.listenForClickOut` is `false`
4747
await wrapper.setData({ listenForClickOut: false })
48-
document.dispatchEvent(clickEvt)
48+
document.dispatchEvent(clickEvent)
4949
await waitNT(wrapper.vm)
5050
expect(count).toBe(1)
5151

src/mixins/focus-in.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('mixins/focus-in', () => {
2727
localVue
2828
})
2929

30-
const focusinEvt = new FocusEvent('focusin')
30+
const focusinEvent = new FocusEvent('focusin')
3131

3232
expect(wrapper).toBeDefined()
3333
expect(count).toBe(0)
@@ -37,7 +37,7 @@ describe('mixins/focus-in', () => {
3737
expect(count).toBe(0)
3838
await wrapper.find('button').trigger('focusin')
3939
expect(count).toBe(1)
40-
document.dispatchEvent(focusinEvt)
40+
document.dispatchEvent(focusinEvent)
4141
await waitNT(wrapper.vm)
4242
expect(count).toBe(2)
4343

@@ -46,7 +46,7 @@ describe('mixins/focus-in', () => {
4646
expect(count).toBe(2)
4747
await wrapper.find('button').trigger('focusin')
4848
expect(count).toBe(2)
49-
document.dispatchEvent(focusinEvt)
49+
document.dispatchEvent(focusinEvent)
5050
await waitNT(wrapper.vm)
5151
expect(count).toBe(2)
5252

0 commit comments

Comments
 (0)