mirror of
https://github.com/zaphar/wasm-web-components.git
synced 2025-07-21 19:40:30 -04:00
More tests around class and element naming
This commit is contained in:
parent
c311de79b1
commit
ff6e9a5079
@ -20,7 +20,7 @@ use web_sys::{window, Element, HtmlElement};
|
||||
pub use wasm_web_component_macros::web_component;
|
||||
|
||||
/// Helper trait for Rust Web Components. This is autogenerated
|
||||
/// by the [`#[web_component]`](wasm_web_component_macros::web_component) attribute.
|
||||
/// by the [`#[web_component]`](web_component) attribute.
|
||||
pub trait WebComponentDef: IntoWasmAbi + Default {
|
||||
fn new() -> Self {
|
||||
Self::default()
|
||||
@ -216,4 +216,14 @@ mod tests {
|
||||
assert_eq!(AnotherElement::class_name(), "AnotherElement");
|
||||
assert_eq!(AnotherElement::element_name(), "another-element");
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn test_component_no_class_name_with_element_name() {
|
||||
#[web_component(element_name = "this-old-element")]
|
||||
pub struct ThisElement {}
|
||||
impl WebComponentBinding for ThisElement {}
|
||||
|
||||
assert_eq!(ThisElement::class_name(), "ThisElement");
|
||||
assert_eq!(ThisElement::element_name(), "this-old-element");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user