Skip to content

Commit fd3c1b1

Browse files
authored
feat(base-select): [base-select] Synchronize the select component code to the base-select component (#3834)
* feat(base-select): [base-select] Synchronize the select component code to the base-select component * feat: add base-select e2e
1 parent 2eafe0c commit fd3c1b1

File tree

11 files changed

+408
-204
lines changed

11 files changed

+408
-204
lines changed

examples/sites/demos/pc/app/base-select/all-text.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ test('多选时自定义全部的文本', async ({ page }) => {
44
page.on('pageerror', (exception) => expect(exception).toBeNull())
55
await page.goto('base-select#all-text')
66
const wrap = page.locator('#all-text')
7-
const select = wrap.locator('.tiny-base-select').nth(0)
7+
const select = wrap.locator('.tiny-base-select')
88
const dropdown = page.locator('body > .tiny-select-dropdown')
99
const option = dropdown.locator('.tiny-option')
1010

11-
await select.locator('.tiny-input__suffix').click()
11+
await select.click()
1212
await expect(option.filter({ hasText: '全部小吃' })).toHaveCount(1)
1313
})

examples/sites/demos/pc/app/base-select/basic-usage.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test('基础用法标签式', async ({ page }) => {
1212
await input.click()
1313
await option.filter({ hasText: '天津' }).click()
1414
await expect(input).toHaveValue('天津')
15-
await select.locator('.tiny-input__suffix svg').click()
15+
await input.click()
1616
await expect(page.getByRole('listitem').filter({ hasText: '天津' })).toHaveClass(/selected/)
1717
await option.filter({ hasText: '深圳' }).click()
1818
await expect(input).toHaveValue('深圳')
@@ -35,7 +35,7 @@ test('基础用法配置式', async ({ page }) => {
3535
await input.click()
3636
await option.filter({ hasText: '天津' }).click()
3737
await expect(input).toHaveValue('天津')
38-
await select.locator('.tiny-input__suffix svg').click()
38+
await input.click()
3939
await expect(page.getByRole('listitem').filter({ hasText: '天津' })).toHaveClass(/selected/)
4040
await option.filter({ hasText: '深圳' }).click()
4141
await expect(input).toHaveValue('深圳')

examples/sites/demos/pc/app/base-select/clearable.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test('clearable', async ({ page }) => {
1515
await icon.click()
1616
await expect(input).toHaveValue('')
1717
// 验证选中
18-
await icon.click()
18+
await input.click()
1919
await dropdown.getByRole('listitem').filter({ hasText: '上海' }).click()
2020
await expect(input).toHaveValue('上海')
2121
})

examples/sites/demos/pc/app/base-select/input-box-type.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ test('下划线默认', async ({ page }) => {
1414
await expect(input).toHaveCSS('border-left-width', '0px')
1515
await expect(input).toHaveCSS('border-right-width', '0px')
1616
await expect(input).toHaveCSS('border-bottom-color', 'rgb(194, 194, 194)')
17-
await expect(select.locator('svg')).toHaveCSS('fill', 'rgb(128, 128, 128)')
1817

1918
await select.click()
2019
await option.first().click()
@@ -36,7 +35,6 @@ test('下划线禁用', async ({ page }) => {
3635
await expect(input).toHaveCSS('border-right-width', '0px')
3736
await expect(input).toHaveCSS('border-bottom-color', 'rgb(219, 219, 219)')
3837
await expect(input).toHaveCSS('cursor', 'not-allowed')
39-
await expect(select.locator('svg')).toHaveCSS('fill', 'rgb(194, 194, 194)')
4038
const hasDisabled = await input.evaluate((input) => input.hasAttribute('disabled'))
4139
await expect(hasDisabled).toBe(true)
4240

examples/sites/demos/pc/app/base-select/multiple.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test('多选时取远端数据与当前已选数据的并集', async ({ page })
1010
const tag = select.locator('.tiny-tag')
1111

1212
await expect(tag).toHaveCount(2)
13-
await select.locator('.tiny-input__suffix').click()
13+
await select.click()
1414
await option.filter({ hasText: '全部' }).click()
1515
await expect(tag).toHaveCount(7)
1616
await option.filter({ hasText: '全部' }).click()

examples/sites/demos/pc/app/base-select/searchable.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test('searchable-single', async ({ page }) => {
2929
})
3030
await option.filter({ hasText: '上海' }).click()
3131
await page.waitForTimeout(500)
32-
await expect(input).toHaveValue('')
32+
await expect(input).toHaveValue('上海')
3333
})
3434

3535
test('searchable-multiple', async ({ page }) => {

0 commit comments

Comments
 (0)