|
1 | 1 | import { expect, test } from '@playwright/test'
|
2 | 2 |
|
3 |
| -test('测试基本用法', async ({ page }) => { |
| 3 | +test('测试下拉表格单选', async ({ page }) => { |
4 | 4 | page.on('pageerror', (exception) => expect(exception).toBeNull())
|
5 |
| - await page.goto('tree-select#basic-usage') |
| 5 | + await page.goto('grid-select#basic-usage') |
6 | 6 |
|
7 | 7 | const wrap = page.locator('#basic-usage')
|
8 |
| - const select = wrap.locator('.tiny-tree-select').nth(0) |
| 8 | + const select = wrap.locator('.tiny-grid-select').nth(0) |
9 | 9 | const input = select.locator('.tiny-input__inner')
|
10 | 10 | const dropdown = page.locator('body > .tiny-select-dropdown')
|
11 |
| - const treeNode = dropdown.locator('.tiny-tree-node') |
| 11 | + const suffixSvg = select.locator('.tiny-base-select__caret') |
| 12 | + const row = dropdown.getByRole('row') |
| 13 | + |
| 14 | + await expect(suffixSvg).toHaveCount(1) |
| 15 | + await expect(suffixSvg).toBeVisible() |
12 | 16 |
|
13 | 17 | await input.click()
|
14 |
| - await expect(treeNode).toHaveCount(7) |
| 18 | + await expect(dropdown).toBeVisible() |
| 19 | + await expect(row).toHaveCount(6) |
15 | 20 |
|
16 |
| - await treeNode.filter({ hasText: /^二级 2-1$/ }).click() |
17 |
| - await expect(input).toHaveValue('二级 2-1') |
| 21 | + await row.nth(1).getByRole('cell').first().click() |
| 22 | + await expect(input).toHaveValue('广州市') |
18 | 23 | await input.click()
|
19 |
| - await expect(treeNode.filter({ hasText: /^二级 2-1$/ })).toHaveClass(/is-current/) |
| 24 | + await expect(row.filter({ hasText: '广州市' })).toHaveClass(/tiny-grid-body__row row__radio/) |
20 | 25 | })
|
0 commit comments