mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 10:07:07 +00:00
修复表单组件样式和单元测试用例 (#7)
* fix: loading small style, search style and dialog style * fix: scroll to top * fix mobile scroll * fix scroll to top * 文档细节优化 * unit test * dialog and image-preview unit test * fix form component style * fix radio and checkbox style * fix search component style
This commit is contained in:
31
test/unit/specs/image-preview.spec.js
Normal file
31
test/unit/specs/image-preview.spec.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import ImagePreview from 'packages/image-preview';
|
||||
|
||||
describe('ImagePreview', () => {
|
||||
afterEach(() => {
|
||||
const el = document.querySelector('.van-image-preview');
|
||||
if (!el) return;
|
||||
if (el.parentNode) {
|
||||
el.parentNode.removeChild(el);
|
||||
}
|
||||
if (el.__vue__) {
|
||||
el.__vue__.$destroy();
|
||||
}
|
||||
});
|
||||
|
||||
it('create a image preview', (done) => {
|
||||
ImagePreview([
|
||||
'https://img.yzcdn.cn/upload_files/2017/03/14/FmTPs0SeyQaAOSK1rRe1sL8RcwSY.jpeg',
|
||||
'https://img.yzcdn.cn/upload_files/2017/03/15/FvexrWlG_WxtCE9Omo5l27n_mAG_.jpeg'
|
||||
]);
|
||||
|
||||
expect(document.querySelector('.van-image-preview')).to.exist;
|
||||
|
||||
setTimeout(() => {
|
||||
document.querySelector('.van-swipe-item').click();
|
||||
setTimeout(() => {
|
||||
expect(document.querySelector('.van-image-preview').__vue__.$parent.value).to.be.false;
|
||||
done();
|
||||
}, 500);
|
||||
}, 500);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user