Skip to content

Commit 636516b

Browse files
authored
fix(select): update select's e2e test for grid update (#3577)
1 parent 4f6ced2 commit 636516b

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

examples/sites/demos/pc/app/select/nest-grid-remote.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test.describe('下拉表格远程搜索', () => {
2828
const row2 = page.getByRole('row', { name: '省份 2 城市 2 区域 2' })
2929
await expect(row2).not.toBeVisible()
3030
await row1.getByRole('cell').first().click()
31-
await expect(row1).toHaveClass(/tiny-grid-body__row row__radio/)
31+
await expect(row1).toHaveClass(/tiny-grid-body__row row__current/)
3232
await expect(input).toHaveValue('省 1-市 1')
3333

3434
const row3 = page.getByRole('row', { name: '省份 10 城市 10 区域 10' })
@@ -64,7 +64,7 @@ test.describe('下拉表格远程搜索', () => {
6464
await input.fill(' ' + ' ')
6565
await input.press('Enter')
6666
await expect(dropdown).toBeVisible()
67-
await expect(dropdown.locator('.tiny-grid__body tbody')).toBeEmpty()
67+
await expect(dropdown.locator('.tiny-grid__body tbody tr').first()).toBeHidden()
6868
})
6969

7070
test('多选,下拉表格远程搜索基础用法', async ({ page }) => {
@@ -131,6 +131,6 @@ test.describe('下拉表格远程搜索', () => {
131131
await input.fill(' ' + ' ')
132132
await input.press('Enter')
133133
await expect(dropdown).toBeVisible()
134-
await expect(dropdown.locator('.tiny-grid__body tbody')).toBeEmpty()
134+
await expect(dropdown.locator('.tiny-grid__body tbody tr').first()).toBeHidden()
135135
})
136136
})

examples/sites/demos/pc/app/select/nest-grid.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test('嵌套表格(单选)', async ({ page }) => {
2121
await row.nth(1).getByRole('cell').first().click()
2222
await expect(input).toHaveValue('深圳 1')
2323
await input.click()
24-
await expect(row.filter({ hasText: '深圳 1' })).toHaveClass(/tiny-grid-body__row row__radio/)
24+
await expect(row.filter({ hasText: '深圳 1' })).toHaveClass(/tiny-grid-body__row row__current/)
2525
})
2626

2727
test('嵌套表格(多选)', async ({ page }) => {

examples/sites/demos/pc/app/select/nest-radio-grid-much-data.spec.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ test('下拉表格大数据', async ({ page }) => {
2323

2424
await input.click()
2525
await page.waitForTimeout(200)
26-
await expect(row.nth(1)).toHaveClass(/tiny-grid-body__row row__radio/)
27-
await expect(row).toHaveCount(6)
26+
await expect(row.nth(1)).toHaveClass(/tiny-grid-body__row row__current/)
27+
await expect(row).toHaveCount(8)
2828
await expect(page.getByRole('row', { name: '华南区 12 广东省 广州市' })).toBeHidden()
2929
await row.nth(5).scrollIntoViewIfNeeded()
30-
await expect(row).toHaveCount(6)
30+
await expect(row).toHaveCount(8)
3131
await row.nth(5).scrollIntoViewIfNeeded()
32-
await expect(row).toHaveCount(6)
32+
await expect(row).toHaveCount(8)
3333
await row.nth(5).scrollIntoViewIfNeeded()
34-
await expect(row).toHaveCount(6)
35-
await page.waitForTimeout(500)
36-
await page.getByRole('row', { name: '华南区 12 广东省 广州市' }).getByRole('cell').first().click()
34+
await expect(row).toHaveCount(8)
3735
})

packages/renderless/src/select/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ export const gridOnQueryChange =
7171

7272
if ((props.filterable || props.searchable) && typeof filterMethod === 'function') {
7373
const table = vm.$refs.selectGrid.$refs.tinyTable
74-
const fullData = table.afterFullData
74+
const fullData = table.getTableData().fullData
7575

7676
vm.$refs.selectGrid.scrollTo(null, 0)
7777

78-
table.afterFullData = filterMethod(value, fullData) || []
78+
table.loadTableData(filterMethod(value, fullData) || [])
7979

8080
vm.$refs.selectGrid
8181
.handleTableData(!value)

0 commit comments

Comments
 (0)