Replace deprecated methods

This commit is contained in:
Alexis Fontaine 2022-04-10 23:57:51 +02:00
parent 103691a000
commit c0220d3551
2 changed files with 19 additions and 19 deletions

View File

@ -1396,31 +1396,31 @@ mod tests {
#[test] #[test]
fn property_signal_types() { fn property_signal_types() {
let _a: DomBuilder<HtmlElement> = DomBuilder::new_html("div") let _a: DomBuilder<HtmlElement> = DomBuilder::new_html("div")
.property("foo", "hi") .prop("foo", "hi")
.property("foo", 5) .prop("foo", 5)
.property(["foo", "-webkit-foo", "-ms-foo"], "hi") .prop(["foo", "-webkit-foo", "-ms-foo"], "hi")
.property_signal("foo", always("hi")) .prop_signal("foo", always("hi"))
.property_signal("foo", always(5)) .prop_signal("foo", always(5))
.property_signal("foo", always(Some("hi"))) .prop_signal("foo", always(Some("hi")))
.property_signal(["foo", "-webkit-foo", "-ms-foo"], always("hi")) .prop_signal(["foo", "-webkit-foo", "-ms-foo"], always("hi"))
.property_signal(["foo", "-webkit-foo", "-ms-foo"], always(5)) .prop_signal(["foo", "-webkit-foo", "-ms-foo"], always(5))
.property_signal(["foo", "-webkit-foo", "-ms-foo"], always(Some("hi"))) .prop_signal(["foo", "-webkit-foo", "-ms-foo"], always(Some("hi")))
; ;
} }
#[test] #[test]
fn attribute_signal_types() { fn attribute_signal_types() {
let _a: DomBuilder<HtmlElement> = DomBuilder::new_html("div") let _a: DomBuilder<HtmlElement> = DomBuilder::new_html("div")
.attribute("foo", "hi") .attr("foo", "hi")
.attribute(["foo", "-webkit-foo", "-ms-foo"], "hi") .attr(["foo", "-webkit-foo", "-ms-foo"], "hi")
.attribute_signal("foo", always("hi")) .attr_signal("foo", always("hi"))
.attribute_signal("foo", always(Some("hi"))) .attr_signal("foo", always(Some("hi")))
.attribute_signal(["foo", "-webkit-foo", "-ms-foo"], always("hi")) .attr_signal(["foo", "-webkit-foo", "-ms-foo"], always("hi"))
.attribute_signal(["foo", "-webkit-foo", "-ms-foo"], always(Some("hi"))) .attr_signal(["foo", "-webkit-foo", "-ms-foo"], always(Some("hi")))
; ;
} }
@ -1491,11 +1491,11 @@ mod tests {
fn with_cfg() { fn with_cfg() {
let _a = html!("div", { let _a = html!("div", {
.with_cfg!(target_arch = "wasm32", { .with_cfg!(target_arch = "wasm32", {
.attribute("foo", "bar") .attr("foo", "bar")
}) })
.with_cfg!(all(not(foo), bar = "test", feature = "hi"), { .with_cfg!(all(not(foo), bar = "test", feature = "hi"), {
.attribute("foo", "bar") .attr("foo", "bar")
}) })
}); });
} }

View File

@ -95,7 +95,7 @@ pub fn link<A, F>(url: A, f: F) -> Dom
let url = url.into(); let url = url.into();
html!("a", { html!("a", {
.attribute("href", &url) .attr("href", &url)
.apply(on_click_go_to_url(url)) .apply(on_click_go_to_url(url))
.apply(f) .apply(f)
}) })
@ -122,7 +122,7 @@ macro_rules! link {
let url = $url; let url = $url;
$crate::html!("a", { $crate::html!("a", {
.attribute("href", &url) .attr("href", &url)
.apply(move |dom| $crate::on_click_go_to_url!(dom, url)) .apply(move |dom| $crate::on_click_go_to_url!(dom, url))
$($methods)* $($methods)*
}) })