From b38176d95a410240adfe28ec5a6349e97fbe165e Mon Sep 17 00:00:00 2001 From: tygao Date: Mon, 4 Mar 2024 13:09:00 +0800 Subject: [PATCH] test: add test for resizable button and service Signed-off-by: tygao --- .../sidecar_service.test.tsx.snap | 13 +++ .../resizable_button.test.tsx.snap | 67 +++++++++++ .../{ => components}/resizable_button.scss | 0 .../components/resizable_button.test.tsx | 92 +++++++++++++++ .../{ => components}/resizable_button.tsx | 8 +- .../sidecar.scss} | 0 .../sidecar/{ => components}/sidecar.tsx | 10 +- src/core/public/overlays/sidecar/helper.ts | 1 - .../overlays/sidecar/sidecar_service.test.tsx | 107 ++++++++++++++++++ .../overlays/sidecar/sidecar_service.tsx | 6 +- 10 files changed, 291 insertions(+), 13 deletions(-) create mode 100644 src/core/public/overlays/sidecar/__snapshots__/sidecar_service.test.tsx.snap create mode 100644 src/core/public/overlays/sidecar/components/__snapshots__/resizable_button.test.tsx.snap rename src/core/public/overlays/sidecar/{ => components}/resizable_button.scss (100%) create mode 100644 src/core/public/overlays/sidecar/components/resizable_button.test.tsx rename src/core/public/overlays/sidecar/{ => components}/resizable_button.tsx (91%) rename src/core/public/overlays/sidecar/{sidecar_service.scss => components/sidecar.scss} (100%) rename src/core/public/overlays/sidecar/{ => components}/sidecar.tsx (89%) create mode 100644 src/core/public/overlays/sidecar/sidecar_service.test.tsx diff --git a/src/core/public/overlays/sidecar/__snapshots__/sidecar_service.test.tsx.snap b/src/core/public/overlays/sidecar/__snapshots__/sidecar_service.test.tsx.snap new file mode 100644 index 000000000000..33d770dbaf23 --- /dev/null +++ b/src/core/public/overlays/sidecar/__snapshots__/sidecar_service.test.tsx.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`SidecarService SidecarRef#close() can be called multiple times on the same SidecarRef 1`] = ` +Array [ + Array [ +
, + ], +] +`; + +exports[`SidecarService openSidecar() renders a sidecar to the DOM 1`] = `"
Sidecar content
"`; + +exports[`SidecarService openSidecar() with a currently active sidecar replaces the current sidecar with a new one 1`] = `"
Sidecar content 2
"`; diff --git a/src/core/public/overlays/sidecar/components/__snapshots__/resizable_button.test.tsx.snap b/src/core/public/overlays/sidecar/components/__snapshots__/resizable_button.test.tsx.snap new file mode 100644 index 000000000000..9d46091330c3 --- /dev/null +++ b/src/core/public/overlays/sidecar/components/__snapshots__/resizable_button.test.tsx.snap @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`is rendered 1`] = ` +