Skip to content

Commit

Permalink
Image: Fix shortcut key not work at second time issue (ElemeFE#18983) (
Browse files Browse the repository at this point in the history
…ElemeFE#19156)

* Image: fix shortcut key not work at second time issue (ElemeFE#18983)

* fix test case

* fix test case

Co-authored-by: cl199793 <[email protected]>
  • Loading branch information
2 people authored and zihe-xu committed Jun 27, 2020
1 parent 46ef91c commit 50368c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/image/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:style="imageStyle"
:class="{ 'el-image__inner--center': alignCenter, 'el-image__preview': preview }">
<template v-if="preview">
<image-viewer :z-index="zIndex" :initial-index="imageIndex" v-show="showViewer" :on-close="closeViewer" :url-list="previewSrcList"/>
<image-viewer :z-index="zIndex" :initial-index="imageIndex" v-if="showViewer" :on-close="closeViewer" :url-list="previewSrcList"/>
</template>
</div>
</template>
Expand Down
5 changes: 2 additions & 3 deletions test/unit/specs/image.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,10 @@ describe('Image', () => {
vm.$el.querySelector('.el-image__inner').click();
await wait();

const $wrapper = vm.$el.querySelector('.el-image-viewer__wrapper');
expect($wrapper).to.exist;
expect(vm.$el.querySelector('.el-image-viewer__wrapper')).to.exist;
vm.$el.querySelector('.el-image-viewer__close').click();
await wait(1000);
expect($wrapper.style.display).to.equal('none');
expect(vm.$el.querySelector('.el-image-viewer__wrapper')).to.not.exist;
});
});

0 comments on commit 50368c5

Please sign in to comment.