Skip to content

Commit

Permalink
test(content): 增加对象类型调用
Browse files Browse the repository at this point in the history
  • Loading branch information
nihaojob committed Sep 1, 2022
1 parent 16556c7 commit bd477a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class Message {
// 对象模式
if(args.length === 1 && typeof args[0] === 'object'){
options = args[0]
console.log(options)
}
return this._render(options.content, options.duration, type, options.onClose, options.closable, options.dangerUseHtml);
}
Expand Down
14 changes: 14 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ describe('图标类型与颜色', () => {
});


describe('对象类型', () => {

test('content', () => {
$msg.destroy()
$msg.info({
content: '对象文本'
})
const boxDom = document.querySelector('.popular-message').innerHTML
expect(boxDom.includes('对象文本')).toBe(true);
});

});


describe('图标类型与颜色', () => {
test('info', () => {
const iconStr = $msg._getIcon('info')
Expand Down

0 comments on commit bd477a9

Please sign in to comment.