Skip to content

Commit 4f8e390

Browse files
committed
test: add test case about globally register vue-final-modal plugin
1 parent 737ee92 commit 4f8e390

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tests/unit/Plugin.spec.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
import { createLocalVue, enableAutoDestroy } from '@vue/test-utils'
2-
import { vfmPlugin } from '../../lib'
2+
import VueFinalModal, { vfmPlugin } from '../../lib'
33

44
enableAutoDestroy(afterEach)
55

66
describe('Plugin', () => {
7+
it('globally register vue-final-modal', () => {
8+
const localVue = createLocalVue()
9+
localVue.use(VueFinalModal())
10+
expect(localVue.options.components).toHaveProperty('VueFinalModal')
11+
expect(localVue.options.components).toHaveProperty('ModalsContainer')
12+
expect(localVue.prototype).toHaveProperty('$vfm')
13+
})
14+
it('globally register vue-final-modal by customized options', () => {
15+
const localVue = createLocalVue()
16+
localVue.use(
17+
VueFinalModal({
18+
key: '_$vfm',
19+
componentName: 'MyModal',
20+
dynamicContainerName: 'MyModalsContainer'
21+
})
22+
)
23+
expect(localVue.options.components).toHaveProperty('MyModal')
24+
expect(localVue.options.components).toHaveProperty('MyModalsContainer')
25+
expect(localVue.prototype).toHaveProperty('_$vfm')
26+
})
727
it('window is undefined in node server', () => {
828
Object.defineProperty(global, 'window', { value: undefined })
929
global.console.error = jest.fn()

0 commit comments

Comments
 (0)