diff --git a/packages/arcodesign/components/image-preview/__test__/index.spec.js b/packages/arcodesign/components/image-preview/__test__/index.spec.js index 021f412a..55faf295 100644 --- a/packages/arcodesign/components/image-preview/__test__/index.spec.js +++ b/packages/arcodesign/components/image-preview/__test__/index.spec.js @@ -118,7 +118,7 @@ describe('ImagePreview', () => { expect(onImageDoubleClick.mock.calls).toHaveLength(1); }); - it('should support thumb bounds', () => { + it('should support thumb bounds', async () => { const props = { staticLabel: true, images: [ @@ -152,6 +152,24 @@ describe('ImagePreview', () => { }); pureDelay(1000); expect(document.querySelectorAll('.image-preview-fake-rect')).toHaveLength(0); + loadImage(document.querySelector(`.${imagePrefix}`), { + top: 0, + bottom: 700, + left: 0, + right: 375, + width: 375, + height: 700, + }); + expect(document.querySelector(`.${prefix}`)).not.toBeNull(); + fireEvent.click(document.querySelector('.image-container img')); + pureDelay(300); + expect(document.querySelector('.closing-animation')).not.toBeNull(); + await waitFor( + () => { + expect(document.querySelector(`.${prefix}`)).toBeNull(); + }, + { timeout: 1000 }, + ); }); it('should support touch event correctly', () => { @@ -197,14 +215,18 @@ describe('ImagePreview', () => { it('should support `ImagePreview.open`', async () => { const onClose = jest.fn(); - window.instance = ImagePreview.open({ staticLabel: true, onClose, images: demoImages }); - // TODO: ReactDOM.render 不生效,待升级 react 18 版本对应的rtl - // pureDelay(1100); - // expect(document.querySelectorAll(`.${imagePrefix}`)).toHaveLength(2); + window.instance = ImagePreview.open({ + staticLabel: true, + onClose, + images: demoImages, + openIndex: 0, + }); + pureDelay(1100); + expect(document.querySelectorAll(`.${imagePrefix}`)).toHaveLength(2); expect(typeof window.instance.close).toBe('function'); expect(typeof window.instance.update).toBe('function'); window.instance.close(); - // pureDelay(1100); - // expect(onClose.mock.calls).toHaveLength(1); + pureDelay(1100); + expect(onClose.mock.calls).toHaveLength(1); }); }); diff --git a/packages/arcodesign/components/pagination/__test__/__snapshots__/index.spec.js.snap b/packages/arcodesign/components/pagination/__test__/__snapshots__/index.spec.js.snap index 79e7e954..4ab56fa5 100644 --- a/packages/arcodesign/components/pagination/__test__/__snapshots__/index.spec.js.snap +++ b/packages/arcodesign/components/pagination/__test__/__snapshots__/index.spec.js.snap @@ -17,8 +17,9 @@ exports[`pagination demo test pagination demo: icon.md renders correctly 1`] = ` Search @@ -163,13 +163,12 @@ exports[`search-bar demo test search-bar demo: custom-pend.md renders correctly role="search" >
City
`; +exports[`slider demo test slider demo: custom-popover.md renders correctly 1`] = ` + +
+
+
+
+
+
+
+
+
+ +
+
+
+ +`; + exports[`slider demo test slider demo: custom-size.md renders correctly 1`] = `
-
+
+
+ + + + + +
+
-
- - - - - + Start
-
- Start -
-
- Details -
+ Details
+
+
+
+ + 2 + +
+
-
- - 2 - + Step 2
-
- Step 2 -
-
- Details -
+ Details
+
+
+
+
+ + 3 + +
-
- - 3 - + Step 3
-
- Step 3 -
-
- Details -
+ Details
+
+
+
+ + 4 + +
+
-
- - 4 - + Finish
-
- Finish -
-
- Details -
+ Details
+
+
+
-
+
+ + + + + +
+
-
- - - - - + Start
-
- Start -
-
- Details -
+ Details
+
+
+
+ + 2 + +
+
-
- - 2 - + Step 2
-
- Step 2 -
-
- Details -
+ Details
+
+
+
+ + 3 + +
+
-
- - 3 - + Step 3
-
- Step 3 -
-
- Details -
+ Details
+
+
+
+ + 4 + +
+
-
- - 4 - + Finish
-
- Finish -
-
- Details -
+ Details