diff --git a/examples/sites/demos/apis/grid-select.js b/examples/sites/demos/apis/grid-select.js index 4b2a6c5d0c..0a4dddb43e 100644 --- a/examples/sites/demos/apis/grid-select.js +++ b/examples/sites/demos/apis/grid-select.js @@ -14,8 +14,7 @@ export default { 'en-US': 'Whether to display the one click clear button, only applicable to radio selection' }, mode: ['pc'], - pcDemo: 'clearable', - mfDemo: 'clearable' + pcDemo: 'basic-usage' }, { name: 'filterable', @@ -26,7 +25,7 @@ export default { 'en-US': 'Is it searchable' }, mode: ['pc'], - pcDemo: 'filter-method' + pcDemo: 'remote' }, { name: 'filter-method', @@ -37,7 +36,7 @@ export default { 'en-US': 'Custom filtering method' }, mode: ['pc'], - pcDemo: 'filter-method' + pcDemo: 'remote' }, { name: 'grid-op', @@ -71,7 +70,7 @@ export default { 'en-US': 'Allow multiple options to be selected' }, mode: ['pc'], - pcDemo: 'multiple' + pcDemo: 'remote' }, { name: 'radio-config', @@ -94,7 +93,7 @@ export default { 'en-US': 'Is it a remote search' }, mode: ['pc'], - pcDemo: 'remote-method' + pcDemo: 'remote' }, { name: 'remote-method', @@ -105,7 +104,7 @@ export default { 'en-US': 'Remote search methods' }, mode: ['pc'], - pcDemo: 'remote-method' + pcDemo: 'remote' }, { name: 'reserve-keyword', @@ -117,7 +116,7 @@ export default { 'When selecting multiple searchable options, do you still keep the current search keywords after selecting one option' }, mode: ['pc'], - pcDemo: 'remote-method' + pcDemo: 'remote' }, { name: 'select-config', diff --git a/examples/sites/demos/pc/app/grid-select/basic-usage.vue b/examples/sites/demos/pc/app/grid-select/basic-usage.vue index 853b49b5f5..39244b3c15 100644 --- a/examples/sites/demos/pc/app/grid-select/basic-usage.vue +++ b/examples/sites/demos/pc/app/grid-select/basic-usage.vue @@ -1,5 +1,7 @@ + + + diff --git a/examples/sites/demos/pc/app/grid-select/extra-query-params.spec.ts b/examples/sites/demos/pc/app/grid-select/extra-query-params.spec.ts new file mode 100644 index 0000000000..b42d2c5035 --- /dev/null +++ b/examples/sites/demos/pc/app/grid-select/extra-query-params.spec.ts @@ -0,0 +1,26 @@ +import { expect, test } from '@playwright/test' + +test('grid-select 初始化查询传参', async ({ page }) => { + page.on('pageerror', (exception) => expect(exception).toBeNull()) + await page.goto('grid-select#extra-query-params') + await page.waitForTimeout(1000) + + // 选中指南 + await page + .locator('div') + .filter({ hasText: /^指南$/ }) + .click() + await page.getByRole('row', { name: '指南' }).locator('path').nth(2).click() + await page.getByRole('row', { name: '组件' }).locator('path').first().click() + await page.getByRole('textbox').nth(3).click() + await page.waitForTimeout(400) + + // 选中框架风格 + await page.getByRole('row', { name: '框架风格' }).locator('div').first().click() + await expect( + page + .locator('div') + .filter({ hasText: /^框架风格$/ }) + .nth(2) + ).toBeVisible() +}) diff --git a/examples/sites/demos/pc/app/grid-select/extra-query-params.vue b/examples/sites/demos/pc/app/grid-select/extra-query-params.vue new file mode 100644 index 0000000000..439afa4893 --- /dev/null +++ b/examples/sites/demos/pc/app/grid-select/extra-query-params.vue @@ -0,0 +1,129 @@ + + + + + + diff --git a/examples/sites/demos/pc/app/grid-select/filter-composition-api.vue b/examples/sites/demos/pc/app/grid-select/filter-composition-api.vue deleted file mode 100644 index ed99e2e95e..0000000000 --- a/examples/sites/demos/pc/app/grid-select/filter-composition-api.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - - - diff --git a/examples/sites/demos/pc/app/grid-select/filter.vue b/examples/sites/demos/pc/app/grid-select/filter.vue deleted file mode 100644 index b0a6d220cc..0000000000 --- a/examples/sites/demos/pc/app/grid-select/filter.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - - - diff --git a/examples/sites/demos/pc/app/grid-select/init-query-composition-api.vue b/examples/sites/demos/pc/app/grid-select/init-query-composition-api.vue new file mode 100644 index 0000000000..82375893a8 --- /dev/null +++ b/examples/sites/demos/pc/app/grid-select/init-query-composition-api.vue @@ -0,0 +1,119 @@ + + + + + + diff --git a/examples/sites/demos/pc/app/grid-select/init-query.spec.ts b/examples/sites/demos/pc/app/grid-select/init-query.spec.ts new file mode 100644 index 0000000000..c3973e54a8 --- /dev/null +++ b/examples/sites/demos/pc/app/grid-select/init-query.spec.ts @@ -0,0 +1,30 @@ +import { expect, test } from '@playwright/test' + +test('测试下拉表格初始化查询', async ({ page }) => { + page.on('pageerror', (exception) => expect(exception).toBeNull()) + await page.goto('grid-select#init-query') + + const wrap = page.locator('#init-query') + const select = wrap.locator('.tiny-grid-select').nth(0) + const input = select.locator('.tiny-input__inner') + const dropdown = page.locator('body > .tiny-select-dropdown') + const rows = dropdown.getByRole('row') + + // 选中广州市1 + await page.waitForTimeout(1000) + await expect(input).toHaveValue('广州市1') + + await input.click() + await expect(dropdown).toBeVisible() + await page.waitForTimeout(1000) + + // 选中广州市0 + await rows.nth(1).getByRole('cell').nth(0).click() + await expect(input).toHaveValue('广州市0') + + // 选中华南区0 + await page.getByRole('textbox').nth(2).click() + await page.waitForTimeout(1000) + await page.getByRole('row', { name: '华南区0 广东省0 广州市' }).locator('path').first().click() + await expect(page.getByText('广州市1广州市2广州市')).toBeVisible() +}) diff --git a/examples/sites/demos/pc/app/grid-select/init-query.vue b/examples/sites/demos/pc/app/grid-select/init-query.vue new file mode 100644 index 0000000000..e2f1c3ed1b --- /dev/null +++ b/examples/sites/demos/pc/app/grid-select/init-query.vue @@ -0,0 +1,127 @@ + + + + + + diff --git a/examples/sites/demos/pc/app/grid-select/multiple-composition-api.vue b/examples/sites/demos/pc/app/grid-select/multiple-composition-api.vue deleted file mode 100644 index 654e0f8ce1..0000000000 --- a/examples/sites/demos/pc/app/grid-select/multiple-composition-api.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - - - diff --git a/examples/sites/demos/pc/app/grid-select/multiple.vue b/examples/sites/demos/pc/app/grid-select/multiple.vue deleted file mode 100644 index 25c992b97f..0000000000 --- a/examples/sites/demos/pc/app/grid-select/multiple.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - - - diff --git a/examples/sites/demos/pc/app/grid-select/radio-bigdata-composition-api.vue b/examples/sites/demos/pc/app/grid-select/radio-bigdata-composition-api.vue new file mode 100644 index 0000000000..b7688ae040 --- /dev/null +++ b/examples/sites/demos/pc/app/grid-select/radio-bigdata-composition-api.vue @@ -0,0 +1,44 @@ + + + + + + diff --git a/examples/sites/demos/pc/app/grid-select/radio-bigdata.spec.ts b/examples/sites/demos/pc/app/grid-select/radio-bigdata.spec.ts new file mode 100644 index 0000000000..d6c766dcc4 --- /dev/null +++ b/examples/sites/demos/pc/app/grid-select/radio-bigdata.spec.ts @@ -0,0 +1,19 @@ +import { expect, test } from '@playwright/test' + +test('grid-select 大量数据', async ({ page }) => { + page.on('pageerror', (exception) => expect(exception).toBeNull()) + await page.goto('grid-select#radio-bigdata') + + await page.waitForFunction(() => window.gridSelectRadioBigData === 800) + + const select = page.locator('#radio-bigdata .tiny-grid-select') + const input = select.locator('.tiny-input__inner') + + await input.click() + + const dropdown = page.locator('body > .tiny-select-dropdown') + const rows = dropdown.getByRole('row') + + await rows.nth(1).getByRole('cell').first().click() + await expect(input).toHaveValue('广州市 0') +}) diff --git a/examples/sites/demos/pc/app/grid-select/radio-bigdata.vue b/examples/sites/demos/pc/app/grid-select/radio-bigdata.vue new file mode 100644 index 0000000000..123f47e4f6 --- /dev/null +++ b/examples/sites/demos/pc/app/grid-select/radio-bigdata.vue @@ -0,0 +1,52 @@ + + + + + + diff --git a/examples/sites/demos/pc/app/grid-select/remote.spec.ts b/examples/sites/demos/pc/app/grid-select/remote.spec.ts new file mode 100644 index 0000000000..9f123e1775 --- /dev/null +++ b/examples/sites/demos/pc/app/grid-select/remote.spec.ts @@ -0,0 +1,23 @@ +import { expect, test } from '@playwright/test' + +test('grid-select 远程搜索', async ({ page }) => { + page.on('pageerror', (exception) => expect(exception).toBeNull()) + await page.goto('grid-select#remote') + + const wrap = page.locator('#remote') + const select = wrap.locator('.tiny-grid-select').first() + const input = select.locator('.tiny-input__inner') + const dropdown = page.locator('body > .tiny-select-dropdown') + + await input.click() + await page.waitForTimeout(1000) + await expect(dropdown).toBeVisible() + + await input.fill('10') + await input.press('Enter') + await page.waitForTimeout(1000) + + // 选中城市10 + await page.getByRole('row', { name: '区域10 省份10 城市' }).getByRole('cell').first().click() + await expect(input).toHaveValue('省10-市10') +}) diff --git a/examples/sites/demos/pc/app/grid-select/remote.vue b/examples/sites/demos/pc/app/grid-select/remote.vue index 17f9ff44ff..345ad7dd57 100644 --- a/examples/sites/demos/pc/app/grid-select/remote.vue +++ b/examples/sites/demos/pc/app/grid-select/remote.vue @@ -1,5 +1,5 @@