Skip to content

Commit

Permalink
fix(components): [slider] fix type error (element-plus#9886)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuhangyeong authored Sep 24, 2022
1 parent 7f5d933 commit 640e3bb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/components/slider/__tests__/slider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// @ts-nocheck
import { h, nextTick, onMounted, ref } from 'vue'
import { mount } from '@vue/test-utils'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { EVENT_CODE } from '@element-plus/constants'
import { ElFormItem } from '@element-plus/components/form'
import Slider from '../src/slider.vue'
import type { SliderProps } from '../src/slider'

vi.mock('lodash-unified', async () => {
return {
Expand Down Expand Up @@ -97,7 +97,8 @@ describe('Slider', () => {
await nextTick()

expect(
document.querySelector(`.${TOOLTIP_CLASS}`).dataset.popperPlacement
(document.querySelector(`.${TOOLTIP_CLASS}`) as HTMLElement).dataset
.popperPlacement
).toBe(PLACEMENT)
})

Expand Down Expand Up @@ -324,8 +325,8 @@ describe('Slider', () => {
it('change event', async () => {
vi.useRealTimers()
const value = ref(0)
const data = ref(0)
const onChange = (val: number) => (data.value = val)
const data = ref<SliderProps['modelValue']>(0)
const onChange = (val: SliderProps['modelValue']) => (data.value = val)
const wrapper = mount(() => (
<div style="width: 200px">
<Slider v-model={value.value} onChange={onChange} />
Expand Down Expand Up @@ -357,8 +358,8 @@ describe('Slider', () => {
it('input event', async () => {
vi.useRealTimers()
const value = ref(0)
const data = ref(0)
const onInput = (val: number) => (data.value = val)
const data = ref<SliderProps['modelValue']>(0)
const onInput = (val: SliderProps['modelValue']) => (data.value = val)
const wrapper = mount(() => (
<div style="width: 200px">
<Slider v-model={value.value} onInput={onInput} />
Expand Down

0 comments on commit 640e3bb

Please sign in to comment.