1 use wasm_bindgen::prelude::*; 2 use wasm_bindgen_test::*; 3 use web_sys::HtmlModElement; 4 5 #[wasm_bindgen(module = "/tests/wasm/element.js")] 6 extern "C" { new_del() -> HtmlModElement7 fn new_del() -> HtmlModElement; new_ins() -> HtmlModElement8 fn new_ins() -> HtmlModElement; 9 } 10 11 #[wasm_bindgen_test] test_mod_elements()12fn test_mod_elements() { 13 let del = new_del(); 14 15 del.set_cite("https://www.rust-lang.org/en-US/"); 16 assert_eq!( 17 del.cite(), 18 "https://www.rust-lang.org/en-US/", 19 "Option should have the cite URI we gave it." 20 ); 21 22 del.set_date_time("Thu Aug 02 2018 18:02:56 GMT-0500 (Central Daylight Time)"); 23 assert_eq!( 24 del.date_time(), 25 "Thu Aug 02 2018 18:02:56 GMT-0500 (Central Daylight Time)", 26 "Option should have the date_time we gave it." 27 ); 28 29 let ins = new_ins(); 30 31 ins.set_cite("https://www.rust-lang.org/en-US/"); 32 assert_eq!( 33 ins.cite(), 34 "https://www.rust-lang.org/en-US/", 35 "Option should have the cite URI we gave it." 36 ); 37 38 ins.set_date_time("Thu Aug 02 2018 18:02:56 GMT-0500 (Central Daylight Time)"); 39 assert_eq!( 40 ins.date_time(), 41 "Thu Aug 02 2018 18:02:56 GMT-0500 (Central Daylight Time)", 42 "Option should have the date_time we gave it." 43 ); 44 } 45