1 use wasm_bindgen::prelude::*;
2 use wasm_bindgen_test::*;
3 use web_sys::HtmlBodyElement;
4 
5 #[wasm_bindgen(module = "/tests/wasm/element.js")]
6 extern "C" {
new_body() -> HtmlBodyElement7     fn new_body() -> HtmlBodyElement;
8 }
9 
10 #[wasm_bindgen_test]
test_body_element()11 fn test_body_element() {
12     let element = new_body();
13     assert_eq!(element.text(), "", "Shouldn't have a text");
14     element.set_text("boop");
15     assert_eq!(element.text(), "boop", "Should have a text");
16 
17     // Legacy color setting
18     assert_eq!(element.link(), "", "Shouldn't have a link");
19     element.set_link("blue");
20     assert_eq!(element.link(), "blue", "Should have a link");
21 
22     assert_eq!(element.v_link(), "", "Shouldn't have a v_link");
23     element.set_v_link("purple");
24     assert_eq!(element.v_link(), "purple", "Should have a v_link");
25 
26     assert_eq!(element.a_link(), "", "Shouldn't have a a_link");
27     element.set_a_link("purple");
28     assert_eq!(element.a_link(), "purple", "Should have a a_link");
29 
30     assert_eq!(element.bg_color(), "", "Shouldn't have a bg_color");
31     element.set_bg_color("yellow");
32     assert_eq!(element.bg_color(), "yellow", "Should have a bg_color");
33 
34     assert_eq!(element.background(), "", "Shouldn't have a background");
35     element.set_background("image");
36     assert_eq!(element.background(), "image", "Should have a background");
37 }
38