mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 12:31:22 +00:00
Add unit tests for more 'web-sys' HTML bindings (#617)
That list includes: * HtmlOptionElement * HtmlOptGroupElement * HtmlOListElement * HtmlModElement
This commit is contained in:
committed by
Alex Crichton
parent
4a78769349
commit
d47fc61c36
22
crates/web-sys/tests/wasm/optgroup_element.rs
Normal file
22
crates/web-sys/tests/wasm/optgroup_element.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use wasm_bindgen_test::*;
|
||||
use wasm_bindgen::prelude::*;
|
||||
use web_sys::HtmlOptGroupElement;
|
||||
|
||||
#[wasm_bindgen(module = "./tests/wasm/element.js")]
|
||||
extern {
|
||||
fn new_optgroup() -> HtmlOptGroupElement;
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn test_optgroup_element() {
|
||||
let optgroup = new_optgroup();
|
||||
|
||||
optgroup.set_disabled(true);
|
||||
assert_eq!(optgroup.disabled(), true, "Optgroup should be disabled after we set it to be disabled.");
|
||||
|
||||
optgroup.set_disabled(false);
|
||||
assert_eq!(optgroup.disabled(), false, "Optgroup should not be disabled after we set it to be not-disabled.");
|
||||
|
||||
optgroup.set_label("Group of options below");
|
||||
assert_eq!(optgroup.label(), "Group of options below", "Optgroup should have the label we gave it.");
|
||||
}
|
Reference in New Issue
Block a user