use htmx::htmx;
use htmx::native::Html;
struct Custom {
href: String,
}
impl Custom {
fn builder() -> Self {
Custom {
href: "default".to_owned(),
}
}
fn href(mut self, value: impl Into<String>) -> Self {
self.href = value.into();
self
}
fn build(self) -> impl Html {
htmx! {
<a href=self.href/>
}
}
}
#[test]
fn test() {
let html = htmx!(
<div>
<a href="hello"/>
<Custom href="test"/>
</div>
);
assert_eq!(
html.into_string(),
"<div><a href=\"hello\"></a><a href=\"test\"></a></div>"
);
}