Merge static and dynamic styles (#3950)

* Merge static and dynamic styles

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Evan AlmloffandJonathan Kelley authored and GitHub committed 2025-05-07 14:15:15 -07:00
1 parent 68c7b903d5
commit ad63d529fd
6 files changed
+47 -3

No files matched your search

+10
View File
@@ -156,6 +156,16 @@ test("document elements", async ({ page }) => {
await expect(main).toHaveCSS("font-family", "Roboto");
});
test("merge styles", async ({ page }) => {
await page.goto("http://localhost:9999");
// wait until the div is mounted
const div = page.locator("div#merge-styles-div");
await div.waitFor({ state: "attached" });
await expect(div).toHaveCSS("background-color", "rgb(255, 0, 0)");
await expect(div).toHaveCSS("width", "100px");
await expect(div).toHaveCSS("height", "100px");
});
test("select multiple", async ({ page }) => {
await page.goto("http://localhost:9999");
// wait until the select element is mounted
+15
View File
@@ -63,6 +63,7 @@ fn app() -> Element {
OnMounted {}
WebSysClosure {}
DocumentElements {}
MergeStyles {}
SelectMultiple {}
}
}
@@ -156,6 +157,20 @@ fn DocumentElements() -> Element {
}
}
// Regression test for https://github.com/DioxusLabs/dioxus/issues/3887
#[component]
fn MergeStyles() -> Element {
let px = 100;
rsx! {
div {
id: "merge-styles-div",
style: "width: {px}px; height: {px}px",
background_color: "red",
}
}
}
// Select elements have odd default behavior when you set the multiple attribute after mounting the element
// Regression test for https://github.com/DioxusLabs/dioxus/issues/3185
#[component]