Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/sites/demos/pc/app/modal/basic-usage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ test('基本用法', async ({ page }) => {

// 消息提示
await page.getByRole('button', { name: '消息提示' }).click()
await expect(content.nth(3)).toHaveText(/简单的消息/)
const info = page.locator('div')
await expect(info.filter({ hasText: '简单的消息' }).nth(1)).toHaveText(/简单的/)

// 打开弹窗 1
await page.getByRole('button', { name: '打开弹窗 1' }).click()
Expand Down
4 changes: 2 additions & 2 deletions examples/sites/demos/pc/app/modal/message-close.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { test, expect } from '@playwright/test'
test('消息的关闭和延时', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('modal#message-close')
const content = page.locator('.tiny-modal__text')
await page.getByRole('button', { name: '消息可关闭' }).click()
await expect(content).toHaveText(/5s 后得自动关闭/)
const info = page.locator('div').filter({ hasText: '自定义消息的内容可关闭,5s 后得自动关闭' })
await expect(info.nth(1)).toHaveText(/5s 后得自动关闭/)
})
4 changes: 2 additions & 2 deletions examples/sites/demos/pc/app/modal/message-id.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { test, expect } from '@playwright/test'
test('防止重复消息提示', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('modal#message-id')
const content = page.locator('.tiny-modal__text')
await page.getByRole('button', { name: '重复点击不出现多个' }).click()
await expect(content).toHaveText(/唯一 id/)
const info = await page.locator('div').filter({ hasText: '自定义消息具有唯一 id,所以不会重复出现' })
await expect(info.nth(1)).toHaveText(/唯一 id/)
})
12 changes: 5 additions & 7 deletions examples/sites/demos/pc/app/modal/modal-fn-slots.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import { test, expect } from '@playwright/test'
test('弹窗的插槽', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('modal#modal-fn-slots')
const content = page.locator('.tiny-modal__content')
const inner = page.locator('.tiny-link__inner')
await page.getByRole('button', { name: '打开带插槽弹窗' }).first().click()
await expect(content.nth(1)).toHaveText(/使用默认插槽/)
const demoElement = page.locator('#modal-fn-slots')
await demoElement.getByRole('button', { name: '打开带插槽弹窗' }).first().click()
const content = page.locator('div').filter({ hasText: /^使用默认插槽$/ })
await expect(content.nth(3)).toHaveText(/使用默认插槽/)
const inner = page.locator('a').filter({ hasText: '记录最近事项' })
await expect(inner.nth(1)).toHaveText(/记录最近事项/)
await page.getByRole('button', { name: '取消' }).click()
await page.getByRole('button', { name: '打开带插槽弹窗' }).nth(1).click()
await expect(content.nth(1)).toHaveText(/使用默认插槽/)
await expect(inner).toHaveText(/记录最近事项/)
})
3 changes: 2 additions & 1 deletion examples/sites/demos/pc/app/modal/modal-header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { test, expect } from '@playwright/test'
test('自定义弹窗标题', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('modal#modal-header')
const demo = page.locator('#modal-header')
const header = page.locator('.tiny-modal__title')

// 自定义弹窗标题
await page.getByRole('button', { name: '自定义弹窗标题' }).first().click()
await demo.getByRole('button', { name: '自定义弹窗标题' }).first().click()
await expect(header.first()).toHaveText(/自定义弹窗标题/)
await page.getByRole('button', { name: '确定' }).click()
})
4 changes: 2 additions & 2 deletions packages/vue/src/modal/src/pc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export default defineComponent({
class: 'tiny-modal__content'
},
defaultSlot
? defaultSlot.call(this, { $modal: this }, h)
? [defaultSlot.call(this, { $modal: this }, h)]
: [
h(
'div',
Expand Down Expand Up @@ -289,7 +289,7 @@ export default defineComponent({
}
},
footerSlot
? footerSlot.call(this, footerSlotParams, h)
? [footerSlot.call(this, footerSlotParams, h)]
: [
type === 'confirm'
? h(
Expand Down
Loading