forked from jd-opensource/nutui
-
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
1 parent
af7fc35
commit 6e9e1c1
Showing
1 changed file
with
44 additions
and
1 deletion.
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 |
---|---|---|
@@ -1 +1,44 @@ | ||
import { mount } from '@vue/test-utils'; | ||
import { config, mount } from '@vue/test-utils'; | ||
import { nextTick, toRefs, reactive } from 'vue'; | ||
import NutIcon from '../../icon/index.vue'; | ||
import NutRate from '../../rate/index.vue'; | ||
import Comment from '../index.vue'; | ||
// import { Sku as SkuData, Goods } from '../data'; | ||
import CommentData from '../comment_data.json'; | ||
|
||
beforeAll(() => { | ||
config.global.components = { | ||
NutIcon, | ||
NutRate | ||
}; | ||
}); | ||
|
||
afterAll(() => { | ||
config.global.components = {}; | ||
}); | ||
|
||
test('comment init render', async () => { | ||
const wrapper = mount(Comment, { | ||
props: { | ||
images: CommentData.Comment.images, | ||
videos: CommentData.Comment.videos, | ||
info: CommentData.Comment.info | ||
} | ||
}); | ||
await nextTick(); | ||
expect(wrapper.find('.nut-comment__main').exists()).toBeTruthy(); | ||
}); | ||
|
||
test('comment mutli images', async () => { | ||
const wrapper = mount(Comment, { | ||
props: { | ||
headerType: 'complex', | ||
imagesRows: 'multi', | ||
images: CommentData.Comment.images, | ||
videos: CommentData.Comment.videos, | ||
info: CommentData.Comment.info | ||
} | ||
}); | ||
await nextTick(); | ||
expect(wrapper.find('.nut-comment-images__mask').exists()).toBeTruthy(); | ||
}); |