tiny-vue/examples/sites/demos/pc/app/dialog-box/close-on-press-escape.spec.ts

14 lines
539 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { test, expect } from '@playwright/test'
test('dialogBox 禁用 ESC 关闭', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('dialog-box#close-on-press-escape')
const button = page.getByRole('button', { name: /Dialog/ })
const dialogBox = page.locator('.tiny-dialog-box')
// dialogBox弹出后禁用 ESC 关闭
await button.click()
await expect(dialogBox).toBeVisible()
await page.locator('body').press('Escape')
await expect(dialogBox).toBeVisible()
})