Fix if chain attributes with mixed expressions and strings (#3149)

* Fix if chain attributes with mixed expressions and strings
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-10-31 12:48:25 -07:00
1 parent 292f757d5d
commit 37a6e9200f
2 files changed
+61 -8

No files matched your search

@@ -10,4 +10,23 @@ fn partially_formatted_conditional_attribute() {
width: if true { "{width}" } else { "100px" }
}
};
// And make sure it works if one of those branches is an expression
// Regression test for https://github.com/DioxusLabs/dioxus/issues/3146
let opt = "button";
_ = rsx! {
input {
type: if true { opt } else { "text" },
}
input {
type: if true { opt.to_string() } else { "text with" },
}
input {
type: if true { opt.to_string() } else { "text with {width}" },
}
input {
type: if true { opt.to_string() } else if true { "" } else { "text with {width}" },
}
};
}