-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(dropdown): [action-menu,dropdown] synchronize modification of te…
…st cases
- Loading branch information
Showing
2 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 18 additions & 17 deletions
35
examples/sites/demos/pc/app/dropdown/split-button.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
// 不展示此示例。按钮类型推荐使用 border | ||
test('按钮类型', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('dropdown#split-button') | ||
// await page.goto('dropdown#split-button') | ||
|
||
const wrap = page.locator('#split-button') | ||
const dropDown = wrap.locator('.tiny-dropdown').nth(1) | ||
const dropDownMenu = page.locator('body > .tiny-dropdown-menu') | ||
const textBtn = dropDown.locator('button').first() | ||
const dropDownBtn = dropDown.locator('button').nth(1) | ||
// const wrap = page.locator('#split-button') | ||
// const dropDown = wrap.locator('.tiny-dropdown').nth(1) | ||
// const dropDownMenu = page.locator('body > .tiny-dropdown-menu') | ||
// const textBtn = dropDown.locator('button').first() | ||
// const dropDownBtn = dropDown.locator('button').nth(1) | ||
|
||
// 是否变成了按钮且按钮样式是否生效 | ||
await expect(dropDown.locator('button')).toHaveCount(2) | ||
await expect(textBtn).toHaveCSS('background-color', 'rgb(92, 179, 0)') | ||
await expect(textBtn).toHaveCSS('color', 'rgb(255, 255, 255)') | ||
await expect(dropDownBtn).toHaveCSS('background-color', 'rgb(92, 179, 0)') | ||
await expect(dropDownBtn).toHaveCSS('color', 'rgb(255, 255, 255)') | ||
// await expect(dropDown.locator('button')).toHaveCount(2) | ||
// await expect(textBtn).toHaveCSS('background-color', 'rgb(92, 179, 0)') | ||
// await expect(textBtn).toHaveCSS('color', 'rgb(255, 255, 255)') | ||
// await expect(dropDownBtn).toHaveCSS('background-color', 'rgb(92, 179, 0)') | ||
// await expect(dropDownBtn).toHaveCSS('color', 'rgb(255, 255, 255)') | ||
|
||
// 文字悬浮不出现下拉菜单 | ||
await page.waitForTimeout(500) | ||
await textBtn.hover() | ||
await expect(dropDownMenu).not.toBeVisible() | ||
await dropDownBtn.hover() | ||
await expect(dropDownMenu).toBeVisible() | ||
// // 文字悬浮不出现下拉菜单 | ||
// await page.waitForTimeout(500) | ||
// await textBtn.hover() | ||
// await expect(dropDownMenu).not.toBeVisible() | ||
// await dropDownBtn.hover() | ||
// await expect(dropDownMenu).toBeVisible() | ||
}) |