From ff6e9a50792eaea535cffd29590d538d558b75ad Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Fri, 7 Oct 2022 10:21:26 -0400 Subject: [PATCH] More tests around class and element naming --- wasm-web-component/src/lib.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wasm-web-component/src/lib.rs b/wasm-web-component/src/lib.rs index e06ba10..3369df9 100644 --- a/wasm-web-component/src/lib.rs +++ b/wasm-web-component/src/lib.rs @@ -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"); + } }