1 use wasm_bindgen::prelude::*; 2 use wasm_bindgen_test::*; 3 use web_sys::HtmlTitleElement; 4 5 #[wasm_bindgen(module = "/tests/wasm/element.js")] 6 extern "C" { new_title() -> HtmlTitleElement7 fn new_title() -> HtmlTitleElement; 8 } 9 10 #[wasm_bindgen_test] title_element()11fn title_element() { 12 let element = new_title(); 13 assert_eq!(element.text().unwrap(), "", "Shouldn't have an text"); 14 assert_eq!(element.set_text("page text").unwrap(), ()); 15 assert_eq!(element.text().unwrap(), "page text", "Should have an text"); 16 } 17