Skip to content

Commit 44852e3

Browse files
committed
feat: unit test z-index
1 parent cc1aaf1 commit 44852e3

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/unit/VueFinalModal.spec.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ describe('VueFinalModal.vue', () => {
179179
expect(wrapper.find('.vfm').classes('vfm--prevent-none')).toBe(true)
180180
expect(wrapper.find('.vfm__content').classes('vfm--prevent-auto')).toBe(true)
181181
})
182-
it('attach: body', async () => {
182+
it('attach: HTMLElement', async () => {
183183
const elem = document.createElement('div')
184184
document.body.appendChild(elem)
185185
const { wrapper } = await createOpenedModal({
@@ -199,5 +199,27 @@ describe('VueFinalModal.vue', () => {
199199
})
200200
expect(document.activeElement === wrapper.find('.vfm__container').vm.$el).toBe(true)
201201
})
202+
it('zIndexAuto', async () => {
203+
const { wrapper } = await createOpenedModal({
204+
zIndexAuto: false
205+
})
206+
expect(wrapper.attributes('style')).not.toContain('z-index')
207+
})
208+
it('zIndexBase', async () => {
209+
const zIndexBase = 2000
210+
const zIndexStyle = `z-index: ${zIndexBase};`
211+
const { wrapper } = await createOpenedModal({
212+
zIndexBase: zIndexBase
213+
})
214+
expect(wrapper.attributes('style')).toContain(zIndexStyle)
215+
})
216+
it('zIndex', async () => {
217+
const zIndex = 3000
218+
const zIndexStyle = `z-index: ${zIndex};`
219+
const { wrapper } = await createOpenedModal({
220+
zIndex
221+
})
222+
expect(wrapper.attributes('style')).toContain(zIndexStyle)
223+
})
202224
})
203225
})

0 commit comments

Comments
 (0)