mod helpers;
use helpers::test_utils::render_into_document;
use indoc::indoc;
use testing_library_dom::pretty_dom;
use wasm_bindgen_test::{wasm_bindgen_test, wasm_bindgen_test_configure};
use self::helpers::test_utils::{render, RenderReturn};
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
fn pretty_dom_prints_out_the_given_dom_element_tree() {
let RenderReturn { container, .. } = render("
...",
pretty_dom(Some(container.clone().into()), Some(5))
);
assert_eq!("", pretty_dom(Some(container.clone().into()), Some(0)));
assert_eq!(
indoc! {"
"},
pretty_dom(Some(container.into()), Some(usize::MAX))
);
}
#[ignore = "`wasm-pack test` crashes when its `pre` elements are overwritten."]
#[wasm_bindgen_test]
fn pretty_dom_defaults_to_document_body() {
render_into_document("
Hello World!
");
assert_eq!(
indoc! {"
Hello World!
"},
pretty_dom(None, None)
);
}
#[ignore = "`wasm-pack test` crashes when its `pre` elements are overwritten."]
#[wasm_bindgen_test]
fn pretty_dom_supports_receiving_the_document_element() {
assert_eq!(
indoc! {"