Skip to content

Commit f8d8e9c

Browse files
committed
tests: updated useZIndex tests according to new updates
1 parent 887becb commit f8d8e9c

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/anu-vue/src/plugin.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export interface PluginOptions {
2929
baseZIndex: number
3030
}
3131

32+
// ℹ️ We are exporting this so that we can use it in tests
33+
export const defaultBaseZIndex = 2000
34+
3235
const configDefaults: PluginOptions = {
3336
registerComponents: true,
3437
initialTheme: 'light',
@@ -68,7 +71,7 @@ const configDefaults: PluginOptions = {
6871
},
6972
componentAliases: {},
7073
propsDefaults: {},
71-
baseZIndex: 2000,
74+
baseZIndex: defaultBaseZIndex,
7275
}
7376

7477
export const plugin = {

packages/anu-vue/test/composables/useZIndex.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
import type { VueWrapper } from '@vue/test-utils'
2+
import { mount } from '@vue/test-utils'
13
import { describe, expect, it } from 'vitest'
24
import type { ComponentPublicInstance } from 'vue'
35
import { defineComponent, nextTick, ref } from 'vue'
4-
import type { VueWrapper } from '@vue/test-utils'
5-
import { mount } from '@vue/test-utils'
6-
import { defaultBaseZIndex, useZIndex, zIndexContextKey } from '../../src/composables/useZIndex'
6+
import { useZIndex } from '../../src/composables/useZIndex'
7+
import { defaultBaseZIndex } from '../../src/plugin'
8+
import { ANU_Z_INDEX } from '../../src/symbols'
79

810
describe('useZIndex', () => {
911
let wrapper: VueWrapper<ComponentPublicInstance>
1012

1113
const mountComponent = (provideZIndex?: number) => mount(
14+
// eslint-disable-next-line vue/require-name-property
1215
defineComponent({
1316
setup(_, { expose }) {
1417
const zIndex = useZIndex()
@@ -19,7 +22,7 @@ describe('useZIndex', () => {
1922
{
2023
global: {
2124
provide: {
22-
[zIndexContextKey]: ref(provideZIndex),
25+
[ANU_Z_INDEX as symbol]: ref(provideZIndex),
2326
},
2427
},
2528
},

0 commit comments

Comments
 (0)