Browse Source

modify test

namnguyen 5 months ago
parent
commit
dc347b5010
1 changed files with 3 additions and 29 deletions
  1. 3 29
      frontend/taipy-gui/src/components/Taipy/Metric.spec.tsx

+ 3 - 29
frontend/taipy-gui/src/components/Taipy/Metric.spec.tsx

@@ -274,14 +274,13 @@ describe("Metric Component", () => {
         });
         });
     });
     });
 
 
-    it("applies style correctly when height is undefined", async () => {
+    it("applies style correctly when height and width are undefined", async () => {
         const { container } = render(<Metric />);
         const { container } = render(<Metric />);
         await waitFor(() => {
         await waitFor(() => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
-                width: "100%",
-                position: "relative",
-                display: "inline-block",
+                width: "20vw",
+                height: "20vh",
             });
             });
         });
         });
     });
     });
@@ -291,10 +290,7 @@ describe("Metric Component", () => {
         await waitFor(() => {
         await waitFor(() => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
-                width: "100%",
                 height: "100px",
                 height: "100px",
-                position: "relative",
-                display: "inline-block",
             });
             });
         });
         });
     });
     });
@@ -304,10 +300,7 @@ describe("Metric Component", () => {
         await waitFor(() => {
         await waitFor(() => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
-                width: "100%",
                 height: "30em",
                 height: "30em",
-                position: "relative",
-                display: "inline-block",
             });
             });
         });
         });
     });
     });
@@ -317,10 +310,7 @@ describe("Metric Component", () => {
         await waitFor(() => {
         await waitFor(() => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
-                width: "100%",
                 height: "30%",
                 height: "30%",
-                position: "relative",
-                display: "inline-block",
             });
             });
         });
         });
     });
     });
@@ -330,10 +320,7 @@ describe("Metric Component", () => {
         await waitFor(() => {
         await waitFor(() => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
-                width: "100%",
                 height: "30vh",
                 height: "30vh",
-                position: "relative",
-                display: "inline-block",
             });
             });
         });
         });
     });
     });
@@ -343,10 +330,7 @@ describe("Metric Component", () => {
         await waitFor(() => {
         await waitFor(() => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
-                width: "100%",
                 height: "30vw",
                 height: "30vw",
-                position: "relative",
-                display: "inline-block",
             });
             });
         });
         });
     });
     });
@@ -357,8 +341,6 @@ describe("Metric Component", () => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
                 width: "100px",
                 width: "100px",
-                position: "relative",
-                display: "inline-block",
             });
             });
         });
         });
     });
     });
@@ -369,8 +351,6 @@ describe("Metric Component", () => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
                 width: "30em",
                 width: "30em",
-                position: "relative",
-                display: "inline-block",
             });
             });
         });
         });
     });
     });
@@ -381,8 +361,6 @@ describe("Metric Component", () => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
                 width: "30%",
                 width: "30%",
-                position: "relative",
-                display: "inline-block",
             });
             });
         });
         });
     });
     });
@@ -393,8 +371,6 @@ describe("Metric Component", () => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
                 width: "30vh",
                 width: "30vh",
-                position: "relative",
-                display: "inline-block",
             });
             });
         });
         });
     });
     });
@@ -405,8 +381,6 @@ describe("Metric Component", () => {
             const elt = container.querySelector(".js-plotly-plot");
             const elt = container.querySelector(".js-plotly-plot");
             expect(elt).toHaveStyle({
             expect(elt).toHaveStyle({
                 width: "30vw",
                 width: "30vw",
-                position: "relative",
-                display: "inline-block",
             });
             });
         });
         });
     });
     });