1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Debug virtual doms!
//! This renderer comes built in with dioxus core and shows how to implement a basic renderer.
//!
//! Renderers don't actually need to own the virtual dom (it's up to the implementer).

use crate::prelude::VirtualDom;

pub struct DebugRenderer {
    vdom: VirtualDom,
}

impl DebugRenderer {
    pub fn new(vdom: VirtualDom) -> Self {
        Self { vdom }
    }

    pub async fn run(&mut self) -> Result<(), ()> {
        Ok(())
    }

    pub fn log_dom(&self) {}
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::prelude::*;

    #[test]
    fn ensure_creation() -> Result<(), ()> {
        let mut dom = VirtualDom::new(|ctx, props| {
            //
            ctx.view(html! { <div>"hello world" </div> })
        });

        // dom.progress()?;
        Ok(())
    }
}