Skip to content

Commit

Permalink
test(dropdown): [action-menu,dropdown] synchronize modification of te…
Browse files Browse the repository at this point in the history
…st cases
  • Loading branch information
MomoPoppy committed Mar 5, 2025
1 parent a5326e8 commit b563ad1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ test('弹框样式', async ({ page }) => {
await visibleItem.last().hover()
await page.waitForTimeout(200)
await expect(dropDownMenu).toHaveClass(/custom-action-menu/)
await expect(dropDownMenu).toHaveCSS('background-color', 'rgb(250, 235, 215)')
await expect(dropDownMenu).toHaveCSS('background-color', 'rgb(255, 255, 255)')
})
35 changes: 18 additions & 17 deletions examples/sites/demos/pc/app/dropdown/split-button.spec.ts
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()
})

0 comments on commit b563ad1

Please sign in to comment.