Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

Commit

Permalink
add test html_string
Browse files Browse the repository at this point in the history
  • Loading branch information
sepiropht committed Jul 23, 2019
1 parent 7088e37 commit 301ab1c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/web/render.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{assert_rendered, before_after, create_element, RenderFn};
use super::{assert_rendered, before_after, create_element, RenderFn, html_string};
use dodrio::{builder::*, Vdom};
use futures::prelude::*;
use std::rc::Rc;
Expand All @@ -10,7 +10,18 @@ fn render_initial_text() {

let container = create_element("div");
let _vdom = Vdom::new(&container, hello.clone());
assert_rendered(&container, &hello);
assert_rendered(container, &hello);
}

fn render_to_string() {
let hello = Rc::new(RenderFn(|cx| {
div(&cx)
.attr("id", "hello-world")
.children([text("Hello "), span(&cx).child(text("World!")).finish()])
.finish()
}));
let string_html = html_string(&hello);
assert!(&string_html, "<div id=hello_world> Hello <span>World!</span></div>");
}

#[wasm_bindgen_test]
Expand Down

0 comments on commit 301ab1c

Please sign in to comment.