mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix: preview unit test
This commit is contained in:
parent
38d8003532
commit
19b814f1db
@ -9,7 +9,7 @@ var travis = process.env.TRAVIS;
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
browsers: travis ? ['PhantomJS'] : ['Chrome'],
|
||||
browsers: travis ? ['PhantomJS'] : ['PhantomJS', 'Chrome'],
|
||||
frameworks: ['mocha', 'sinon-chai'],
|
||||
reporters: ['spec', 'coverage'],
|
||||
files: ['./index.js'],
|
||||
|
@ -1,4 +1,5 @@
|
||||
import ImagePreview from 'packages/image-preview';
|
||||
import Wrapper from 'avoriaz/dist/Wrapper';
|
||||
|
||||
describe('ImagePreview', () => {
|
||||
beforeEach(() => {
|
||||
@ -22,7 +23,11 @@ describe('ImagePreview', () => {
|
||||
expect(document.querySelector('.van-image-preview')).to.exist;
|
||||
|
||||
setTimeout(() => {
|
||||
document.querySelector('.van-swipe-item').click();
|
||||
const image = document.querySelector('.van-image-preview');
|
||||
const avImage = new Wrapper({ elm: image }, () => {}, false);
|
||||
avImage.simulate('click');
|
||||
avImage.simulate('touchstart');
|
||||
avImage.simulate('touchend');
|
||||
setTimeout(() => {
|
||||
expect(document.querySelector('.van-image-preview').__vue__.$parent.value).to.be.false;
|
||||
expect(document.body.style.overflow).to.equal('');
|
||||
@ -42,7 +47,12 @@ describe('ImagePreview', () => {
|
||||
expect(document.querySelector('.van-image-preview')).to.exist;
|
||||
|
||||
setTimeout(() => {
|
||||
document.querySelector('.van-swipe-item').click();
|
||||
const image = document.querySelector('.van-image-preview');
|
||||
const avImage = new Wrapper({ elm: image }, () => {}, false);
|
||||
avImage.simulate('click');
|
||||
avImage.simulate('touchstart');
|
||||
avImage.simulate('touchend');
|
||||
|
||||
setTimeout(() => {
|
||||
expect(document.querySelector('.van-image-preview').__vue__.$parent.value).to.be.false;
|
||||
expect(document.body.style.overflow).to.equal('hidden');
|
||||
|
Loading…
x
Reference in New Issue
Block a user