From 39f9456b243f9a5eb212828d5134d76536b459b0 Mon Sep 17 00:00:00 2001 From: 233mawile <903945079@qq.com> Date: Wed, 25 May 2022 16:40:28 +0800 Subject: [PATCH] test(fix-dialog-size): [snapshot] fix ut of PortalHost and update snapshot --- .../__snapshots__/Dialog.story.tsx.snap | 36 +++++++++++++++++++ .../__snapshots__/Downshift.story.tsx.snap | 28 +++++++++++++++ .../__snapshots__/Drawer.story.tsx.snap | 24 +++++++++++++ .../__snapshots__/PopupBox.story.tsx.snap | 4 +++ .../PortalHost/__tests__/PortalHost.test.tsx | 32 ++++++++--------- .../__snapshots__/Responsive.story.tsx.snap | 8 +++++ .../__snapshots__/Tooltip.story.tsx.snap | 20 +++++++++++ .../__snapshots__/ZoomFrom.story.tsx.snap | 22 ++++++++++-- .../useResponsiveMatch.story.tsx.snap | 4 +++ sync-github.json | 2 +- 10 files changed, 160 insertions(+), 20 deletions(-) diff --git a/packages/juno-core/src/components/Dialog/__stories__/__snapshots__/Dialog.story.tsx.snap b/packages/juno-core/src/components/Dialog/__stories__/__snapshots__/Dialog.story.tsx.snap index b6a5c62e..477cbc87 100644 --- a/packages/juno-core/src/components/Dialog/__stories__/__snapshots__/Dialog.story.tsx.snap +++ b/packages/juno-core/src/components/Dialog/__stories__/__snapshots__/Dialog.story.tsx.snap @@ -76,6 +76,10 @@ exports[`Storyshots 🚀 Cleanup Components/Dialog/Dialog Dialog 1`] = ` } } +@media (max-width:463.95px) { + +} + , @media (hover:hover) and (pointer:fine) { @@ -267,6 +275,10 @@ Array [ } +@media (max-width:463.95px) { + +} + , .c0 { text-transform: none; @@ -355,6 +367,10 @@ Array [ } +@media (max-width:463.95px) { + +} + = { manager: PortalManager; }; +const setup = () => { + const manager = new PortalManager(); + render(); + return manager; +}; + describe('Close portal', () => { it.each([ [ @@ -118,8 +125,7 @@ describe('Close portal', () => { }, ], ])('Should close portal correctly (%s)', async (_, handleClose) => { - const manager = new PortalManager(); - render(); + const manager = setup(); const controller = manager.open(TestComponent); @@ -140,8 +146,7 @@ describe('Close portal', () => { }); it('Should close all portal after invoke manager.closeAll', async () => { - const portalManager = new PortalManager(); - render(); + const portalManager = setup(); portalManager.open(TestComponent); portalManager.open(TestComponent); @@ -192,8 +197,7 @@ describe('Update props', () => { }, ], ])('Should update props correctly (%s)', async (_, handleUpdate) => { - const manager = new PortalManager(); - render(); + const manager = setup(); const controller = manager.open(TestComponent, { props: { text: '24' }, @@ -220,8 +224,7 @@ describe('Update props', () => { describe('Check order', () => { it('The last one to open should be at the top', async () => { - const manager = new PortalManager(); - render(); + const manager = setup(); manager.open(TestComponent, { props: { 'data-test-automation-id': 'A' } as any, @@ -243,8 +246,7 @@ describe('Check order', () => { describe('feedback', () => { it('Should get feedback correctly after close dialog', async () => { - const portalManager = new PortalManager(); - render(); + const portalManager = setup(); const controller1 = portalManager.open(TestComponent, { props: { feedback: 'feed1' }, @@ -298,8 +300,7 @@ describe('feedback', () => { }); it('Should get feedback `undefined` after close all dialog', async () => { - const portalManager = new PortalManager(); - render(); + const portalManager = setup(); const controller1 = portalManager.open(TestComponent, { props: { feedback: 'feed1' }, @@ -331,8 +332,7 @@ describe('feedback', () => { }); it('Should clean `portalManager._feedbackMap` after close dialog', async () => { - const portalManager = new PortalManager(); - render(); + const portalManager = setup(); const controller = portalManager.open(TestComponent, { props: { feedback: 'feeeed' }, diff --git a/packages/juno-core/src/components/Responsive/__stories__/__snapshots__/Responsive.story.tsx.snap b/packages/juno-core/src/components/Responsive/__stories__/__snapshots__/Responsive.story.tsx.snap index 0406b8df..c15e64f8 100644 --- a/packages/juno-core/src/components/Responsive/__stories__/__snapshots__/Responsive.story.tsx.snap +++ b/packages/juno-core/src/components/Responsive/__stories__/__snapshots__/Responsive.story.tsx.snap @@ -10,6 +10,10 @@ Array [ color: #BE3933; } +@media (max-width:463.95px) { + +} + diff --git a/packages/juno-core/src/components/Tooltip/__stories__/__snapshots__/Tooltip.story.tsx.snap b/packages/juno-core/src/components/Tooltip/__stories__/__snapshots__/Tooltip.story.tsx.snap index fb4b0cb4..888da252 100644 --- a/packages/juno-core/src/components/Tooltip/__stories__/__snapshots__/Tooltip.story.tsx.snap +++ b/packages/juno-core/src/components/Tooltip/__stories__/__snapshots__/Tooltip.story.tsx.snap @@ -2578,6 +2578,10 @@ Array [ } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { } @@ -2699,6 +2703,10 @@ Array [ } } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { } @@ -2762,6 +2770,10 @@ Array [ } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { } @@ -2791,6 +2803,10 @@ Array [ } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { } @@ -2914,6 +2930,10 @@ Array [ } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { .c1.RcSwitch-root:hover .RcSwitch-switchBase:not(.RcSwitch-disabled) + .RcSwitch-track { background-color: rgba(147,147,147,0.92); diff --git a/packages/juno-core/src/components/Transitions/ZoomFrom/__stories__/__snapshots__/ZoomFrom.story.tsx.snap b/packages/juno-core/src/components/Transitions/ZoomFrom/__stories__/__snapshots__/ZoomFrom.story.tsx.snap index 6069c6ef..86251cac 100644 --- a/packages/juno-core/src/components/Transitions/ZoomFrom/__stories__/__snapshots__/ZoomFrom.story.tsx.snap +++ b/packages/juno-core/src/components/Transitions/ZoomFrom/__stories__/__snapshots__/ZoomFrom.story.tsx.snap @@ -302,6 +302,10 @@ Array [ background-color: rgba(6,111,172,0.76); } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { .c1.RcSwitch-root:hover .RcSwitch-switchBase:not(.RcSwitch-disabled) + .RcSwitch-track { background-color: rgba(147,147,147,0.92); @@ -359,17 +363,29 @@ Array [ Show , - @media (hover:hover) and (pointer:fine) { + @media (max-width:463.95px) { + +} + +@media (hover:hover) and (pointer:fine) { } , - @media (hover:hover) and (pointer:fine) { + @media (max-width:463.95px) { + +} + +@media (hover:hover) and (pointer:fine) { } , - @media (hover:hover) and (pointer:fine) { + @media (max-width:463.95px) { + +} + +@media (hover:hover) and (pointer:fine) { } diff --git a/packages/juno-core/src/foundation/hooks/useResponsiveMatch/__stories__/__snapshots__/useResponsiveMatch.story.tsx.snap b/packages/juno-core/src/foundation/hooks/useResponsiveMatch/__stories__/__snapshots__/useResponsiveMatch.story.tsx.snap index bdf10f88..f48c1834 100644 --- a/packages/juno-core/src/foundation/hooks/useResponsiveMatch/__stories__/__snapshots__/useResponsiveMatch.story.tsx.snap +++ b/packages/juno-core/src/foundation/hooks/useResponsiveMatch/__stories__/__snapshots__/useResponsiveMatch.story.tsx.snap @@ -76,6 +76,10 @@ exports[`Storyshots 🔧 Foundation/Hooks/useResponsiveMatch Responsive Dialog 1 } } +@media (max-width:463.95px) { + +} +
diff --git a/packages/juno-core/src/components/Tooltip/__stories__/__snapshots__/Tooltip.story.tsx.snap b/packages/juno-core/src/components/Tooltip/__stories__/__snapshots__/Tooltip.story.tsx.snap index fb4b0cb4..888da252 100644 --- a/packages/juno-core/src/components/Tooltip/__stories__/__snapshots__/Tooltip.story.tsx.snap +++ b/packages/juno-core/src/components/Tooltip/__stories__/__snapshots__/Tooltip.story.tsx.snap @@ -2578,6 +2578,10 @@ Array [ } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { } @@ -2699,6 +2703,10 @@ Array [ } } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { } @@ -2762,6 +2770,10 @@ Array [ } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { } @@ -2791,6 +2803,10 @@ Array [ } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { } @@ -2914,6 +2930,10 @@ Array [ } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { .c1.RcSwitch-root:hover .RcSwitch-switchBase:not(.RcSwitch-disabled) + .RcSwitch-track { background-color: rgba(147,147,147,0.92); diff --git a/packages/juno-core/src/components/Transitions/ZoomFrom/__stories__/__snapshots__/ZoomFrom.story.tsx.snap b/packages/juno-core/src/components/Transitions/ZoomFrom/__stories__/__snapshots__/ZoomFrom.story.tsx.snap index 6069c6ef..86251cac 100644 --- a/packages/juno-core/src/components/Transitions/ZoomFrom/__stories__/__snapshots__/ZoomFrom.story.tsx.snap +++ b/packages/juno-core/src/components/Transitions/ZoomFrom/__stories__/__snapshots__/ZoomFrom.story.tsx.snap @@ -302,6 +302,10 @@ Array [ background-color: rgba(6,111,172,0.76); } +@media (max-width:463.95px) { + +} + @media (hover:hover) and (pointer:fine) { .c1.RcSwitch-root:hover .RcSwitch-switchBase:not(.RcSwitch-disabled) + .RcSwitch-track { background-color: rgba(147,147,147,0.92); @@ -359,17 +363,29 @@ Array [ Show , - @media (hover:hover) and (pointer:fine) { + @media (max-width:463.95px) { + +} + +@media (hover:hover) and (pointer:fine) { } , - @media (hover:hover) and (pointer:fine) { + @media (max-width:463.95px) { + +} + +@media (hover:hover) and (pointer:fine) { } , - @media (hover:hover) and (pointer:fine) { + @media (max-width:463.95px) { + +} + +@media (hover:hover) and (pointer:fine) { } diff --git a/packages/juno-core/src/foundation/hooks/useResponsiveMatch/__stories__/__snapshots__/useResponsiveMatch.story.tsx.snap b/packages/juno-core/src/foundation/hooks/useResponsiveMatch/__stories__/__snapshots__/useResponsiveMatch.story.tsx.snap index bdf10f88..f48c1834 100644 --- a/packages/juno-core/src/foundation/hooks/useResponsiveMatch/__stories__/__snapshots__/useResponsiveMatch.story.tsx.snap +++ b/packages/juno-core/src/foundation/hooks/useResponsiveMatch/__stories__/__snapshots__/useResponsiveMatch.story.tsx.snap @@ -76,6 +76,10 @@ exports[`Storyshots 🔧 Foundation/Hooks/useResponsiveMatch Responsive Dialog 1 } } +@media (max-width:463.95px) { + +} +