1 use wasm_bindgen::prelude::*;
2 use wasm_bindgen_test::*;
3 use web_sys::HtmlStyleElement;
4
5 #[wasm_bindgen(module = "/tests/wasm/element.js")]
6 extern "C" {
new_style() -> HtmlStyleElement7 fn new_style() -> HtmlStyleElement;
8 }
9
10 #[wasm_bindgen_test]
test_style_element()11 fn test_style_element() {
12 let element = new_style();
13 assert!(!element.disabled(), "Should be disabled");
14 element.set_disabled(true);
15 assert!(!element.disabled(), "Should be disabled"); // Not sure why this is but Chrome in Firefox behabe the same
16
17 assert_eq!(element.type_(), "", "Shouldn't have a type");
18 element.set_type("text/css");
19 assert_eq!(element.type_(), "text/css", "Should have a type");
20
21 assert_eq!(element.media(), "", "Shouldn't have a media");
22 element.set_media("screen, print");
23 assert_eq!(element.media(), "screen, print", "Should have a media");
24 }
25