diff --git a/packages/utils/__tests__/vue/refs.test.ts b/packages/utils/__tests__/vue/refs.test.ts new file mode 100644 index 0000000000..a723bbdff7 --- /dev/null +++ b/packages/utils/__tests__/vue/refs.test.ts @@ -0,0 +1,11 @@ +import { describe, expect, it, vi } from 'vitest' +import { composeRefs } from '../..' + +describe('composeRefs', () => { + it('ref setter should be called', () => { + const refSetter = vi.fn() + const fn = composeRefs(refSetter) + fn(null) + expect(refSetter).toHaveBeenCalled() + }) +}) diff --git a/packages/utils/__tests__/vue/size.test.ts b/packages/utils/__tests__/vue/size.test.ts new file mode 100644 index 0000000000..c0c57c9ef6 --- /dev/null +++ b/packages/utils/__tests__/vue/size.test.ts @@ -0,0 +1,19 @@ +import { describe, expect, it } from 'vitest' +import { getComponentSize } from '../..' + +describe('vue size', () => { + it('default value', () => { + const value1 = getComponentSize() + const value2 = getComponentSize('default') + expect(value1).toBe(32) + expect(value2).toBe(32) + }) + it('small value', () => { + const value = getComponentSize('small') + expect(value).toBe(24) + }) + it('large value', () => { + const value = getComponentSize('large') + expect(value).toBe(40) + }) +}) diff --git a/packages/utils/__tests__/vue/validator.test.ts b/packages/utils/__tests__/vue/validator.test.ts new file mode 100644 index 0000000000..6a61c1eaf3 --- /dev/null +++ b/packages/utils/__tests__/vue/validator.test.ts @@ -0,0 +1,25 @@ +import { describe, expect, it } from 'vitest' +import { isValidComponentSize, isValidDatePickType } from '../..' + +describe('validator', () => { + it('isValidComponentSize', () => { + expect(isValidComponentSize('')).toBe(true) + expect(isValidComponentSize('default')).toBe(true) + expect(isValidComponentSize('small')).toBe(true) + expect(isValidComponentSize('large')).toBe(true) + expect(isValidComponentSize('unknown')).toBe(false) + }) + it('isValidDatePickType', () => { + expect(isValidDatePickType('year')).toBe(true) + expect(isValidDatePickType('years')).toBe(true) + expect(isValidDatePickType('month')).toBe(true) + expect(isValidDatePickType('date')).toBe(true) + expect(isValidDatePickType('dates')).toBe(true) + expect(isValidDatePickType('week')).toBe(true) + expect(isValidDatePickType('datetime')).toBe(true) + expect(isValidDatePickType('datetimerange')).toBe(true) + expect(isValidDatePickType('daterange')).toBe(true) + expect(isValidDatePickType('monthrange')).toBe(true) + expect(isValidDatePickType('moment')).toBe(false) + }) +})