wip: it works but the page is backwards
This commit is contained in:
1 parent
a0a977a12d
commit
cdcd8611e8
19 files changed
+239
-349
No files matched your search
@@ -46,7 +46,7 @@ pub fn render_vdom_scope(vdom: &VirtualDom, scope: ScopeId) -> Option<String> {
|
||||
/// ```ignore
|
||||
/// static App: FC<()> = |cx| cx.render(rsx!(div { "hello world" }));
|
||||
/// let mut vdom = VirtualDom::new(App);
|
||||
/// vdom.rebuild_in_place();
|
||||
/// vdom.rebuild();
|
||||
///
|
||||
/// let renderer = TextRenderer::new(&vdom);
|
||||
/// let output = format!("{}", renderer);
|
||||
@@ -74,7 +74,7 @@ impl<'a> TextRenderer<'a> {
|
||||
}
|
||||
|
||||
fn html_render(&self, node: &VNode, f: &mut std::fmt::Formatter, il: u16) -> std::fmt::Result {
|
||||
match &node.kind {
|
||||
match &node {
|
||||
VNode::Text(text) => {
|
||||
if self.cfg.indent {
|
||||
for _ in 0..il {
|
||||
@@ -286,28 +286,28 @@ mod tests {
|
||||
#[test]
|
||||
fn to_string_works() {
|
||||
let mut dom = VirtualDom::new(SIMPLE_APP);
|
||||
dom.rebuild_in_place().expect("failed to run virtualdom");
|
||||
dom.rebuild().expect("failed to run virtualdom");
|
||||
dbg!(render_vdom(&dom, |c| c));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hydration() {
|
||||
let mut dom = VirtualDom::new(NESTED_APP);
|
||||
dom.rebuild_in_place().expect("failed to run virtualdom");
|
||||
dom.rebuild().expect("failed to run virtualdom");
|
||||
dbg!(render_vdom(&dom, |c| c.pre_render(true)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nested() {
|
||||
let mut dom = VirtualDom::new(NESTED_APP);
|
||||
dom.rebuild_in_place().expect("failed to run virtualdom");
|
||||
dom.rebuild().expect("failed to run virtualdom");
|
||||
dbg!(render_vdom(&dom, |c| c));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fragment_app() {
|
||||
let mut dom = VirtualDom::new(FRAGMENT_APP);
|
||||
dom.rebuild_in_place().expect("failed to run virtualdom");
|
||||
dom.rebuild().expect("failed to run virtualdom");
|
||||
dbg!(render_vdom(&dom, |c| c));
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ mod tests {
|
||||
let mut file = File::create("index.html").unwrap();
|
||||
|
||||
let mut dom = VirtualDom::new(SLIGHTLY_MORE_COMPLEX);
|
||||
dom.rebuild_in_place().expect("failed to run virtualdom");
|
||||
dom.rebuild().expect("failed to run virtualdom");
|
||||
|
||||
file.write_fmt(format_args!(
|
||||
"{}",
|
||||
@@ -337,7 +337,7 @@ mod tests {
|
||||
};
|
||||
|
||||
let mut dom = VirtualDom::new(STLYE_APP);
|
||||
dom.rebuild_in_place().expect("failed to run virtualdom");
|
||||
dom.rebuild().expect("failed to run virtualdom");
|
||||
dbg!(render_vdom(&dom, |c| c));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user