// ██████╗ █████╗ ███████╗███████╗██╗███╗ ██╗ ██████╗
// ██╔══██╗██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝
// ██████╔╝███████║███████╗███████╗██║██╔██╗ ██║██║ ███╗
// ██╔═══╝ ██╔══██║╚════██║╚════██║██║██║╚██╗██║██║ ██║
// ██║ ██║ ██║███████║███████║██║██║ ╚████║╚██████╔╝
// ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
#[cfg(test)]
mod passing {
use crate::html;
use crate::opts::Options;
#[test]
fn div_as_root_element() {
let html = "
";
let dom = html::html_to_dom(&html);
let options = Options::default();
assert_eq!(
html::stringify_document(&dom.document, &options),
""
);
}
#[test]
fn full_page_with_no_html_head_or_body() {
let html = "Isolated document\
\
\
";
let dom = html::html_to_dom(&html);
let mut options = Options::default();
options.isolate = true;
assert_eq!(
html::stringify_document(
&dom.document,
&options
),
"\
\
\
Isolated document\
\
\
\
\
\
\
\
\
"
);
}
#[test]
fn doctype_and_the_rest_no_html_head_or_body() {
let html = "\
Unstyled document\
\
";
let dom = html::html_to_dom(&html);
let mut options = Options::default();
options.no_css = true;
assert_eq!(
html::stringify_document(&dom.document, &options),
"\
\
\
\
Unstyled document\
\
\
\
"
);
}
#[test]
fn doctype_and_the_rest_no_html_head_or_body_forbid_frames() {
let html = "\
Frameless document\
\
";
let dom = html::html_to_dom(&html);
let mut options = Options::default();
options.no_frames = true;
assert_eq!(
html::stringify_document(
&dom.document,
&options
),
"\
\
\
\
Frameless document\
\
\
\
"
);
}
#[test]
fn doctype_and_the_rest_all_forbidden() {
let html = "\
no-frame no-css no-js no-image isolated document\
\
\
\
\
\
\
";
let dom = html::html_to_dom(&html);
let mut options = Options::default();
options.isolate = true;
options.no_css = true;
options.no_fonts = true;
options.no_frames = true;
options.no_js = true;
options.no_images = true;
assert_eq!(
html::stringify_document(
&dom.document,
&options
),
"\
\
\
\
no-frame no-css no-js no-image isolated document\
\
\
\
\
\
\
\
\
\
\
"
);
}
}