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