use sycamore::prelude::*;
use wasm_bindgen::JsCast;
use web_sys::{Element, HtmlElement};
pub(crate) fn query(selectors: &str) -> Element {
document()
.query_selector(selectors)
.expect("selectors should be valid")
.expect("element to be found that matches the selectors")
}
pub(crate) fn query_into<T: AsRef<HtmlElement> + JsCast>(selectors: &str) -> T {
query(selectors)
.dyn_into()
.expect("element found should be of the same type as used for the generic T")
}
macro_rules! assert_text_content {
($element: expr, $right: expr $(,)?) => {
assert_eq!($element.text_content().unwrap(), $right);
};
}
pub(crate) use assert_text_content;