summaryrefslogtreecommitdiffstats
path: root/vendor/web-sys/tests/wasm/optgroup_element.rs
blob: 99d72dada4ab6ef5002baf45d0e3b11b6208ec6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
use web_sys::HtmlOptGroupElement;

#[wasm_bindgen(module = "/tests/wasm/element.js")]
extern "C" {
    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."
    );
}