Merge branch 'master' into intigrate-collect-assets
This commit is contained in:
1 parent
ffb5de91d1
commit
f976e08f71
379 files changed
+1962
-13517
No files matched your search
@@ -0,0 +1,37 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
#[test]
|
||||
fn static_boolean_attributs() {
|
||||
fn app(cx: Scope) -> Element {
|
||||
render! {
|
||||
div { hidden: "false" }
|
||||
div { hidden: "true" }
|
||||
}
|
||||
}
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
_ = dom.rebuild();
|
||||
|
||||
assert_eq!(
|
||||
dioxus_ssr::render(&dom),
|
||||
r#"<div></div><div hidden="true"></div>"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dynamic_boolean_attributs() {
|
||||
fn app(cx: Scope) -> Element {
|
||||
render! {
|
||||
div { hidden: false }
|
||||
div { hidden: true }
|
||||
}
|
||||
}
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
_ = dom.rebuild();
|
||||
|
||||
assert_eq!(
|
||||
dioxus_ssr::render(&dom),
|
||||
r#"<div></div><div hidden=true></div>"#
|
||||
);
|
||||
}
|
||||
@@ -2,11 +2,12 @@ use dioxus::prelude::*;
|
||||
|
||||
#[test]
|
||||
fn simple() {
|
||||
fn app(cx: Scope) -> Element {
|
||||
#[component]
|
||||
fn App(cx: Scope) -> Element {
|
||||
render! { div { "hello!" } }
|
||||
}
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
let mut dom = VirtualDom::new(App);
|
||||
_ = dom.rebuild();
|
||||
|
||||
assert_eq!(dioxus_ssr::render(&dom), "<div>hello!</div>");
|
||||
@@ -44,8 +45,8 @@ fn dynamic() {
|
||||
|
||||
#[test]
|
||||
fn components() {
|
||||
#[inline_props]
|
||||
fn my_component(cx: Scope, name: i32) -> Element {
|
||||
#[component]
|
||||
fn MyComponent(cx: Scope, name: i32) -> Element {
|
||||
render! {
|
||||
div { "component {name}" }
|
||||
}
|
||||
@@ -55,7 +56,7 @@ fn components() {
|
||||
dioxus_ssr::render_lazy(rsx! {
|
||||
div {
|
||||
(0..5).map(|name| rsx! {
|
||||
my_component { name: name }
|
||||
MyComponent { name: name }
|
||||
})
|
||||
}
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user