namnguyen 5 月之前
父节点
当前提交
2ada2478ce
共有 3 个文件被更改,包括 7 次插入6 次删除
  1. 3 0
      frontend/taipy-gui/src/components/Taipy/Metric.tsx
  2. 2 2
      taipy/gui/viselements.json
  3. 2 4
      tests/gui/e2e/test_resizing.py

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

@@ -56,6 +56,9 @@ const defaultLayout = { margin: { l: 50, r: 50, t: 50, b: 50 } } as Partial<Layo
 const defaultStyle = {
     position: "relative",
     display: "inline-block",
+    /*
+    * When updating the width and height, be sure to adjust the corresponding Metric values in the viselements.json file accordingly.
+    * */
     width: "20vw",
     height: "20vh",
 } as CSSProperties;

+ 2 - 2
taipy/gui/viselements.json

@@ -1427,13 +1427,13 @@
                     {
                         "name": "width",
                         "type": "Union[str,number]",
-                        "default_value": "20vw",
+                        "default_value": "\"20vw\"",
                         "doc": "The width of the metric control, in CSS units"
                     },
                     {
                         "name": "height",
                         "type": "Union[str,number]",
-                        "default_value": "20vh",
+                        "default_value": "\"20vh\"",
                         "doc": "The height of the metric control, in CSS units"
                     },
                     {

+ 2 - 4
tests/gui/e2e/test_resizing.py

@@ -19,9 +19,7 @@ def test_has_default_value(page: Page, gui: Gui, helpers):
         (1864, 55.03),
     ]
     data = pandas.DataFrame(percentages, columns=["Year", "%"]) # noqa: F841
-    page_md = """
-<|{data}|chart|type=bar|x=Year|y=%|>
-"""
+    page_md = "<|{data}|chart|type=bar|x=Year|y=%|>"
     gui._set_frame(inspect.currentframe())
     gui.add_page(name="test",page=page_md)
     helpers.run_e2e(gui)
@@ -36,4 +34,4 @@ def test_has_default_value(page: Page, gui: Gui, helpers):
     page.set_viewport_size({"width": 1920, "height": 1080})
     page.wait_for_timeout(1000)
     box_after = first_element.bounding_box()
-    assert box_after['width'] > box_before['width']
+    assert box_after["width"] > box_before["width"]