Skip to content

Commit 90c299c

Browse files
jacobmllr95tmorehouse
authored andcommitted
feat(modal): remove BvModalEvent deprecations (#3864)
1 parent bea49d4 commit 90c299c

File tree

3 files changed

+6
-83
lines changed

3 files changed

+6
-83
lines changed

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import BvEvent from '../../../utils/bv-event.class'
2-
import warn from '../../../utils/warn'
32
import { defineProperties, readonlyDescriptor } from '../../../utils/object'
43

54
class BvModalEvent extends BvEvent {
@@ -11,18 +10,6 @@ class BvModalEvent extends BvEvent {
1110
})
1211
}
1312

14-
get modalId() /* istanbul ignore next */ {
15-
// Backwards compatability <= 2.0.0-rc.19
16-
warn('b-modal: evt.modalId is deprecated. Please use evt.componentId.')
17-
return this.componentId
18-
}
19-
20-
cancel() /* istanbul ignore next */ {
21-
// Backwards compatibility for BootstrapVue 1.x
22-
warn('b-modal: evt.cancel() is deprecated. Please use evt.preventDefault().')
23-
this.preventDefault()
24-
}
25-
2613
static get Defaults() {
2714
return {
2815
...super.Defaults,

src/components/modal/helpers/bv-modal-event.class.spec.js

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,6 @@ describe('modal > BvModalEvent', () => {
6868
}
6969
expect(failed).toBe(true)
7070
expect(evt.trigger).toBe('ok')
71-
72-
failed = false
73-
try {
74-
evt.modalId = 'fail'
75-
} catch (e) {
76-
failed = true
77-
}
78-
expect(failed).toBe(true)
79-
expect(evt.componentId).toBe('foo')
8071
})
8172

8273
it('supports custom properties', async () => {
@@ -88,48 +79,4 @@ describe('modal > BvModalEvent', () => {
8879
expect(evt.cancelable).toBe(true)
8980
expect(evt.custom).toBe(123)
9081
})
91-
92-
describe('Deprecated features', () => {
93-
it('supports cancelable events via deprecated evt.cancel()', async () => {
94-
// Mock `console.warn()` to prevent a console warning and
95-
// check wether a warning about the `evt.cancel()` call
96-
// was made
97-
const warn = console.warn
98-
console.warn = jest.fn()
99-
100-
const evt = new BvModalEvent('foobar', {
101-
cancelable: true
102-
})
103-
104-
expect(evt).toBeInstanceOf(BvModalEvent)
105-
expect(evt.type).toBe('foobar')
106-
expect(evt.cancelable).toBe(true)
107-
expect(evt.defaultPrevented).toBe(false)
108-
evt.cancel()
109-
expect(evt.defaultPrevented).toBe(true)
110-
111-
expect(console.warn).toHaveBeenCalled()
112-
console.warn = warn
113-
})
114-
115-
it('supports deprecated evt.modalId', async () => {
116-
// Mock `console.warn()` to prevent a console warning and
117-
// check wether a warning about the `evt.cancel()` call
118-
// was made
119-
const warn = console.warn
120-
console.warn = jest.fn()
121-
122-
const evt = new BvModalEvent('foobar', {
123-
componentId: 'foo'
124-
})
125-
126-
expect(evt).toBeInstanceOf(BvModalEvent)
127-
expect(evt.type).toBe('foobar')
128-
expect(evt.componentId).toBe('foo')
129-
expect(evt.modalId).toBe('foo')
130-
131-
expect(console.warn).toHaveBeenCalled()
132-
console.warn = warn
133-
})
134-
})
13582
})

src/components/modal/index.d.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
//
2-
// Modals
3-
//
1+
// --- Modals ---
42
import Vue, { VNode } from 'vue'
53
import { BvPlugin, BvComponent, BvEvent } from '../../'
64

7-
// Modal Plugin
5+
// Modal plugin
86
export declare const ModalPlugin: BvPlugin
97

10-
// Component: b-modal
8+
// Component: <b-modal>
119
export declare class BModal extends BvComponent {
1210
// Public methods
1311
show: () => void
1412
hide: (trigger?: string) => void
1513
}
1614

17-
//
18-
// Types
19-
//
15+
// --- Types ---
2016
export type BvMsgBoxData = boolean | null | BvModalEvent | any
2117

22-
//
23-
// Interfaces
24-
//
18+
// --- Interfaces ---
2519
export interface BvModalEvent extends BvEvent {
2620
readonly trigger: string | null
2721
// Future
2822
// details: any | null
29-
// Deprecated
30-
readonly modalId: string | null
31-
cancel: () => void
3223
}
3324

3425
export interface BvMsgBoxOptions {
@@ -95,9 +86,7 @@ export interface BvModal {
9586
hide: (id: string) => void
9687
}
9788

98-
//
99-
// Vue Prototype Injections
100-
//
89+
// --- Vue prototype injections ---
10190
declare module 'vue/types/vue' {
10291
interface Vue {
10392
// Modal injection

0 commit comments

Comments
 (0)