Skip to content

Commit

Permalink
test(image): update snapshot(Tencent#1410)
Browse files Browse the repository at this point in the history
  • Loading branch information
siyaojia committed May 30, 2024
1 parent b49c23c commit 86133d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/image/__test__/__snapshots__/index.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ exports[`Image > props > : lazy 1`] = `
<div
class="t-image t-image--square"
>
<!--v-if-->
<!---->
<picture>
<!--v-if-->
<!---->
<img
alt=""
class="t-image__img"
Expand Down
4 changes: 2 additions & 2 deletions src/image/__test__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ describe('Image', () => {
const wrapper = mount(() => <Image src={IMAGE} lazy />);
await nextTick();
const $image = wrapper.find(`.${name}__img`);
// expect(wrapper.find(`.${name}__mask`).exists()).toBeTruthy();
expect(wrapper.find(`.${name}__mask`).exists()).toBeFalsy();
// 触发 IntersectionObserver , 但图片加载完成不会触发 load 回调,
$image.trigger('resize');
await nextTick();
expect($image.attributes('src')).toBe(IMAGE);
// 手动触发 图片加载完成的回调函数
await $image.trigger('load');
// expect(wrapper.element).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
expect(wrapper.find(`.${name}__mask`).exists()).toBeFalsy();
});

Expand Down
12 changes: 6 additions & 6 deletions src/image/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { ref, computed, defineComponent, watchEffect } from 'vue';
import { useIntersectionObserver } from '@vueuse/core';
import { CloseIcon } from 'tdesign-icons-vue-next';

import Loading from '@/loading';
import config from '@/config';
import { useTNodeJSX } from '@/hooks/tnode';
import { usePrefixClass } from '@/hooks/useClass';
import Loading from '../loading';
import config from '../config';
import { useTNodeJSX } from '../hooks/tnode';
import { usePrefixClass } from '../hooks/useClass';

import ImageProps from './props';
import props from './props';

const { prefix } = config;
const name = `${prefix}-image`;

export default defineComponent({
name,
components: { CloseIcon, Loading },
props: ImageProps,
props,
setup(props, context) {
const imageClass = usePrefixClass('image');
const renderTNodeJSX = useTNodeJSX();
Expand Down

0 comments on commit 86133d4

Please sign in to comment.