forked from hug-sun/element3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wuls
committed
Dec 24, 2020
1 parent
2a4cf07
commit 6858619
Showing
6 changed files
with
59 additions
and
573 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ describe('MessageBox.js', () => { | |
expect(instanceProprety.message).toBeTruthy() | ||
expect(callback).toHaveBeenCalled() | ||
}) | ||
test('alert', async () => { | ||
test('confirm', async () => { | ||
messageBox.confirm({ | ||
type: 'warning', | ||
title: '消息', | ||
|
@@ -65,26 +65,23 @@ describe('MessageBox.js', () => { | |
}) | ||
test('kind of prompt', async () => { | ||
let v = '' | ||
// const callback = jest.fn(({ value }) => { | ||
// v = value | ||
// }) | ||
messageBox | ||
.prompt('请输入邮箱', '提示', { | ||
confirmButtonText: '确定', | ||
cancelButtonText: '取消', | ||
confirmButtonClass: 'mmm', | ||
inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/, | ||
inputErrorMessage: '邮箱格式不正确' | ||
}) | ||
.then(({ action }) => { | ||
v = action | ||
}) | ||
await sleep() | ||
const callback = jest.fn(({ value }) => { | ||
v = value | ||
}) | ||
const instance = messageBox.prompt('请输入邮箱', '提示', { | ||
confirmButtonText: '确定', | ||
cancelButtonText: '取消', | ||
confirmButtonClass: 'mmm', | ||
inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/, | ||
inputErrorMessage: '邮箱格式不正确' | ||
}) | ||
instance.then(callback) | ||
await nextTick() | ||
const btn = document.querySelector('.mmm') | ||
btn.click() | ||
instance.instance.proxy.inputValue = '[email protected]' | ||
await btn.click() | ||
await sleep() | ||
console.log('>>>>', v) | ||
// await nextTick() | ||
// expect(callback).toHaveBeenCalled() | ||
expect(callback).toHaveBeenCalled() | ||
expect(v).toBeTruthy() | ||
}) | ||
}) |
12 changes: 7 additions & 5 deletions
12
packages/element3/packages/message-box/__tests__/Prop.spec.js
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,8 +1,10 @@ | ||
import porps from '../src/prop/prop' | ||
import props from '../src/prop/prop' | ||
describe('porps', () => { | ||
test('props', () => { | ||
let o = { title: '23232', type: 'info' } | ||
const b = Object.assign(porps, o) | ||
expect(b.title).toBe('23232') | ||
test('type', () => { | ||
expect(props.type.validator('success')).toBeTruthy() | ||
expect(props.type.validator()).toBeFalsy() | ||
}) | ||
test('category', () => { | ||
expect(props.category.validator('alert')).toBeTruthy() | ||
}) | ||
}) |
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
Oops, something went wrong.