tiny-vue/examples/sites/demos/pc/app/action-menu/spacing.spec.ts

18 lines
782 B
TypeScript

import { test, expect } from '@playwright/test'
test('菜单项间距', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('action-menu#spacing')
const wrap = page.locator('#spacing')
const actionMenu = wrap.locator('.tiny-action-menu')
const getDivider = (parent) => parent.locator('.tiny-action-menu__item-line').first()
const tenPXSpacing = actionMenu.first()
const twentyPXSpacing = actionMenu.nth(1)
await expect(getDivider(tenPXSpacing)).toHaveCSS('margin-left', '10px')
await expect(getDivider(tenPXSpacing)).toHaveCSS('margin-right', '10px')
await expect(getDivider(twentyPXSpacing)).toHaveCSS('margin-left', '20px')
await expect(getDivider(twentyPXSpacing)).toHaveCSS('margin-right', '20px')
})