2020-07-14 06:58:29 +00:00
|
|
|
// ██████╗ █████╗ ███████╗███████╗██╗███╗ ██╗ ██████╗
|
|
|
|
// ██╔══██╗██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝
|
|
|
|
// ██████╔╝███████║███████╗███████╗██║██╔██╗ ██║██║ ███╗
|
|
|
|
// ██╔═══╝ ██╔══██║╚════██║╚════██║██║██║╚██╗██║██║ ██║
|
|
|
|
// ██║ ██║ ██║███████║███████║██║██║ ╚████║╚██████╔╝
|
|
|
|
// ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod passing {
|
2021-10-17 07:16:37 +00:00
|
|
|
use monolith::html;
|
2020-07-14 06:58:29 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn icon() {
|
|
|
|
let html = "<link rel=\"icon\" href=\"\" /><div>text</div>";
|
2021-10-17 07:16:37 +00:00
|
|
|
let dom = html::html_to_dom(&html.as_bytes().to_vec(), "".to_string());
|
2020-07-14 06:58:29 +00:00
|
|
|
let res: bool = html::has_favicon(&dom.document);
|
|
|
|
|
|
|
|
assert!(res);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn shortcut_icon() {
|
|
|
|
let html = "<link rel=\"shortcut icon\" href=\"\" /><div>text</div>";
|
2021-10-17 07:16:37 +00:00
|
|
|
let dom = html::html_to_dom(&html.as_bytes().to_vec(), "".to_string());
|
2020-07-14 06:58:29 +00:00
|
|
|
let res: bool = html::has_favicon(&dom.document);
|
|
|
|
|
|
|
|
assert!(res);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ███████╗ █████╗ ██╗██╗ ██╗███╗ ██╗ ██████╗
|
|
|
|
// ██╔════╝██╔══██╗██║██║ ██║████╗ ██║██╔════╝
|
|
|
|
// █████╗ ███████║██║██║ ██║██╔██╗ ██║██║ ███╗
|
|
|
|
// ██╔══╝ ██╔══██║██║██║ ██║██║╚██╗██║██║ ██║
|
|
|
|
// ██║ ██║ ██║██║███████╗██║██║ ╚████║╚██████╔╝
|
|
|
|
// ╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod failing {
|
2021-10-17 07:16:37 +00:00
|
|
|
use monolith::html;
|
2020-07-14 06:58:29 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn absent() {
|
|
|
|
let html = "<div>text</div>";
|
2021-10-17 07:16:37 +00:00
|
|
|
let dom = html::html_to_dom(&html.as_bytes().to_vec(), "".to_string());
|
2020-07-14 06:58:29 +00:00
|
|
|
let res: bool = html::has_favicon(&dom.document);
|
|
|
|
|
|
|
|
assert!(!res);
|
|
|
|
}
|
|
|
|
}
|