1 use wasm_bindgen::prelude::*; 2 use wasm_bindgen_test::*; 3 use web_sys::XPathResult; 4 5 #[wasm_bindgen(module = "/tests/wasm/element.js")] 6 extern "C" { new_xpath_result() -> XPathResult7 fn new_xpath_result() -> XPathResult; 8 } 9 10 #[wasm_bindgen_test] test_xpath_result()11fn test_xpath_result() { 12 let xpath_result = new_xpath_result(); 13 assert_eq!( 14 xpath_result.result_type(), 15 XPathResult::UNORDERED_NODE_ITERATOR_TYPE 16 ); 17 assert_eq!(xpath_result.invalid_iterator_state(), false); 18 assert_eq!( 19 xpath_result 20 .iterate_next() 21 .unwrap() 22 .unwrap() 23 .text_content() 24 .unwrap(), 25 "tomato" 26 ); 27 } 28