Skip to content

Commit

Permalink
test: 晚上图片集单测
Browse files Browse the repository at this point in the history
  • Loading branch information
sqzhou committed Nov 16, 2023
1 parent 97a1809 commit da3bf75
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 25 deletions.
15 changes: 2 additions & 13 deletions packages/amis/__tests__/renderers/Image.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,7 @@ describe('Renderer:image', () => {
'.cxd-ImageGallery-toolbar .cxd-ImageGallery-toolbar-action'
);

expect(actions!.length).toBe(5);

const imgIns = baseElement.querySelector('.cxd-ImageGallery-main img')!;

expect(imgIns).toHaveStyle({
transform: 'translate(0px, 0px) scale(1) rotate(0deg)'
});

fireEvent.click(actions[1].firstElementChild!);
expect(imgIns).toHaveStyle({
transform: 'translate(0px, 0px) scale(1) rotate(90deg)'
});
expect(actions!.length).toBe(4);
});

test('image:width & height', async () => {
Expand Down Expand Up @@ -653,7 +642,7 @@ describe('Renderer:images', () => {

expect(
baseElement.querySelectorAll(
'.cxd-ImageGallery-footer .cxd-ImageGallery-itemsWrap .cxd-ImageGallery-item'
'.cxd-Sliding-content-lists .cxd-Sliding-content-lists-item'
)!.length
).toBe(3);
});
Expand Down
60 changes: 48 additions & 12 deletions packages/amis/__tests__/renderers/__snapshots__/Image.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -704,15 +704,27 @@ exports[`Renderer:images images:enlargeAble & originalSrc & source & title & des
>
<div
class="cxd-Image-title"
title="图片1"
title="[object Object]"
>
图片1
<span
class="cxd-TplField"
>
<span>
图片1
</span>
</span>
</div>
<div
class="cxd-Image-caption"
title="图片1的描述"
title="[object Object]"
>
图片1的描述
<span
class="cxd-TplField"
>
<span>
图片1的描述
</span>
</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -751,15 +763,27 @@ exports[`Renderer:images images:enlargeAble & originalSrc & source & title & des
>
<div
class="cxd-Image-title"
title="图片2"
title="[object Object]"
>
图片2
<span
class="cxd-TplField"
>
<span>
图片2
</span>
</span>
</div>
<div
class="cxd-Image-caption"
title="图片2的描述"
title="[object Object]"
>
图片2的描述
<span
class="cxd-TplField"
>
<span>
图片2的描述
</span>
</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -798,15 +822,27 @@ exports[`Renderer:images images:enlargeAble & originalSrc & source & title & des
>
<div
class="cxd-Image-title"
title="图片3"
title="[object Object]"
>
图片3
<span
class="cxd-TplField"
>
<span>
图片3
</span>
</span>
</div>
<div
class="cxd-Image-caption"
title="图片3的描述"
title="[object Object]"
>
图片3的描述
<span
class="cxd-TplField"
>
<span>
图片3的描述
</span>
</span>
</div>
</div>
</div>
Expand Down

0 comments on commit da3bf75

Please sign in to comment.