|
1 | 1 | import { test, expect } from '@playwright/test'
|
2 | 2 |
|
| 3 | +// 不展示此示例。按钮类型推荐使用 border |
3 | 4 | test('按钮类型', async ({ page }) => {
|
4 | 5 | page.on('pageerror', (exception) => expect(exception).toBeNull())
|
5 |
| - await page.goto('dropdown#split-button') |
| 6 | + // await page.goto('dropdown#split-button') |
6 | 7 |
|
7 |
| - const wrap = page.locator('#split-button') |
8 |
| - const dropDown = wrap.locator('.tiny-dropdown').nth(1) |
9 |
| - const dropDownMenu = page.locator('body > .tiny-dropdown-menu') |
10 |
| - const textBtn = dropDown.locator('button').first() |
11 |
| - const dropDownBtn = dropDown.locator('button').nth(1) |
| 8 | + // const wrap = page.locator('#split-button') |
| 9 | + // const dropDown = wrap.locator('.tiny-dropdown').nth(1) |
| 10 | + // const dropDownMenu = page.locator('body > .tiny-dropdown-menu') |
| 11 | + // const textBtn = dropDown.locator('button').first() |
| 12 | + // const dropDownBtn = dropDown.locator('button').nth(1) |
12 | 13 |
|
13 | 14 | // 是否变成了按钮且按钮样式是否生效
|
14 |
| - await expect(dropDown.locator('button')).toHaveCount(2) |
15 |
| - await expect(textBtn).toHaveCSS('background-color', 'rgb(92, 179, 0)') |
16 |
| - await expect(textBtn).toHaveCSS('color', 'rgb(255, 255, 255)') |
17 |
| - await expect(dropDownBtn).toHaveCSS('background-color', 'rgb(92, 179, 0)') |
18 |
| - await expect(dropDownBtn).toHaveCSS('color', 'rgb(255, 255, 255)') |
| 15 | + // await expect(dropDown.locator('button')).toHaveCount(2) |
| 16 | + // await expect(textBtn).toHaveCSS('background-color', 'rgb(92, 179, 0)') |
| 17 | + // await expect(textBtn).toHaveCSS('color', 'rgb(255, 255, 255)') |
| 18 | + // await expect(dropDownBtn).toHaveCSS('background-color', 'rgb(92, 179, 0)') |
| 19 | + // await expect(dropDownBtn).toHaveCSS('color', 'rgb(255, 255, 255)') |
19 | 20 |
|
20 |
| - // 文字悬浮不出现下拉菜单 |
21 |
| - await page.waitForTimeout(500) |
22 |
| - await textBtn.hover() |
23 |
| - await expect(dropDownMenu).not.toBeVisible() |
24 |
| - await dropDownBtn.hover() |
25 |
| - await expect(dropDownMenu).toBeVisible() |
| 21 | + // // 文字悬浮不出现下拉菜单 |
| 22 | + // await page.waitForTimeout(500) |
| 23 | + // await textBtn.hover() |
| 24 | + // await expect(dropDownMenu).not.toBeVisible() |
| 25 | + // await dropDownBtn.hover() |
| 26 | + // await expect(dropDownMenu).toBeVisible() |
26 | 27 | })
|
0 commit comments