diff --git a/examples/sites/demos/pc/app/select/multiple.spec.ts b/examples/sites/demos/pc/app/select/multiple.spec.ts index 15a2793f35..bdbb87909c 100644 --- a/examples/sites/demos/pc/app/select/multiple.spec.ts +++ b/examples/sites/demos/pc/app/select/multiple.spec.ts @@ -14,13 +14,15 @@ test('多选时取远端数据与当前已选数据的并集', async ({ page }) await option.filter({ hasText: '全部' }).click() await expect(tag).toHaveCount(7) await option.filter({ hasText: '全部' }).click() - await expect(tag).toHaveCount(0) + await expect(tag).toHaveCount(2) await option.filter({ hasText: '北京' }).click() - await expect(tag).toHaveCount(1) + await expect(tag).toHaveCount(2) await option.filter({ hasText: '上海' }).click() await expect(tag).toHaveCount(2) - await tag.filter({ hasText: '上海' }).locator('.tiny-tag__close').click() - await expect(tag).toHaveCount(1) + await option.filter({ hasText: '天津' }).click() + await expect(tag).toHaveCount(3) + await tag.filter({ hasText: '天津' }).locator('.tiny-tag__close').click() + await expect(tag).toHaveCount(2) }) test('multiple-limit', async ({ page }) => { diff --git a/examples/sites/demos/pc/app/select/size.spec.ts b/examples/sites/demos/pc/app/select/size.spec.ts index b5c80b65f7..9a4acc0b7a 100644 --- a/examples/sites/demos/pc/app/select/size.spec.ts +++ b/examples/sites/demos/pc/app/select/size.spec.ts @@ -9,7 +9,7 @@ test('默认尺寸', async ({ page }) => { const input = select.locator('.tiny-input') const tag = select.locator('.tiny-tag') - await expect(input.locator('.tiny-input__inner')).toHaveCSS('height', '28px') + await expect(input.locator('.tiny-input__inner')).toHaveCSS('height', '32px') await expect(tag.nth(0)).toHaveClass(/tiny-tag--light/) }) @@ -23,6 +23,7 @@ test('medium 尺寸', async ({ page }) => { const tag = select.locator('.tiny-tag') await expect(input).toHaveClass(/tiny-input-medium/) + // TODO: 此处继承input 尺寸的话,应该是32 await expect(input.locator('.tiny-input__inner')).toHaveCSS('height', '40px') await expect(tag.nth(0)).toHaveClass(/tiny-tag--medium tiny-tag--light/) }) @@ -39,7 +40,7 @@ test('small 尺寸', async ({ page }) => { await expect(input).toHaveClass(/tiny-input-small/) await expect(tag.nth(0)).toHaveClass(/tiny-tag--small tiny-tag--light/) - expect(height).toBeCloseTo(32, 1) + expect(height).toBeCloseTo(28, 1) }) test('mini 尺寸', async ({ page }) => { diff --git a/examples/sites/demos/pc/app/slider/show-input.spec.ts b/examples/sites/demos/pc/app/slider/show-input.spec.ts index 25e9db0467..92e8531663 100644 --- a/examples/sites/demos/pc/app/slider/show-input.spec.ts +++ b/examples/sites/demos/pc/app/slider/show-input.spec.ts @@ -4,7 +4,7 @@ test('输入框模式', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) await page.goto('slider#show-input') - const sliderInput = page.locator('.tiny-slider-container .tiny-slider__input input') + const sliderInput = page.locator('.tiny-slider-container .tiny-slider__input .tiny-input__inner') const sliderBlock = page.locator('.tiny-slider-container .tiny-slider .tiny-slider__handle') const sliderTip = page.locator('.tiny-slider-container .tiny-slider .tiny-slider__tips') @@ -17,6 +17,7 @@ test('输入框模式', async ({ page }) => { await singleBlock.hover() await expect(sliderTip.nth(0)).toHaveText('60') + await page.waitForTimeout(200) // 双输入框 await sliderInput.nth(1).click() await sliderInput.nth(1).fill('70') diff --git a/packages/renderless/src/slider/index.ts b/packages/renderless/src/slider/index.ts index afaa43c523..2578461357 100644 --- a/packages/renderless/src/slider/index.ts +++ b/packages/renderless/src/slider/index.ts @@ -641,7 +641,7 @@ export const updateSlotValue = export const handleSlotInput = ({ state, api }: Pick) => - (event: Event, isLeftInput: boolean = true): void => { + (event: Event, isLeftInput = true): void => { const inputValue = (event.target as HTMLInputElement).value api.changeActiveValue(state.isDouble ? isLeftInput : true) @@ -651,9 +651,9 @@ export const handleSlotInput = export const inputOnChange = ({ api, emit, props, state }: Pick) => - (event: Event) => { + (currentValue: string) => { if (!props.changeCompat) { - if (!/^\d+$/.test(event.target.value)) { + if (!/^\d+$/.test(currentValue)) { state.activeValue = state.leftBtnValue return }