diff options
Diffstat (limited to 'vendor/web-sys/tests/wasm/element.rs')
-rw-r--r-- | vendor/web-sys/tests/wasm/element.rs | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/vendor/web-sys/tests/wasm/element.rs b/vendor/web-sys/tests/wasm/element.rs index a408a9c7c..fcb423715 100644 --- a/vendor/web-sys/tests/wasm/element.rs +++ b/vendor/web-sys/tests/wasm/element.rs @@ -57,14 +57,26 @@ fn element() { get_attribute_ns */ - /*TODO should we enable toggle_attribute tests? (Firefox Nightly + Chrome canary only) - // TODO toggle_attribute should permit a single argument when optional arguments are supported - assert!(!element.has_attribute("disabled"), "Should not be disabled"); - assert!(element.toggle_attribute("disabled", true).unwrap(), "Should return true when attribute is set"); - assert!(element.has_attribute("disabled"), "Should be disabled"); - assert!(!element.toggle_attribute("disabled", false).unwrap(), "Should return false when attribute is not set"); - assert!(!element.has_attribute("disabled"), "Should not be disabled"); - */ + assert!(!element.has_attribute("disabled"), "Should not be disabled"); + assert!( + element.toggle_attribute("disabled").unwrap(), + "Should return true when attribute is set" + ); + assert!(element.has_attribute("disabled"), "Should be disabled"); + assert!( + element + .toggle_attribute_with_force("disabled", true) + .unwrap(), + "Should return true when attribute is set" + ); + assert!(element.has_attribute("disabled"), "Should be disabled"); + assert!( + !element + .toggle_attribute_with_force("disabled", false) + .unwrap(), + "Should return false when attribute is not set" + ); + assert!(!element.has_attribute("disabled"), "Should not be disabled"); assert!(!element.has_attribute("title"), "Should not have a title"); assert_eq!( @@ -73,7 +85,11 @@ fn element() { "Should return nothing if set correctly" ); assert!(element.has_attribute("title"), "Should have a title"); - // TODO check get_attribute here when supported + assert_eq!( + element.get_attribute("title").unwrap(), + "boop", + "Title should be 'boop'" + ); assert_eq!( element.remove_attribute("title").unwrap(), (), @@ -98,7 +114,7 @@ fn element() { ); /* Tests needed for: remove_attribute_ns - has_attribure_ns + has_attribute_ns closest */ @@ -129,8 +145,6 @@ fn element() { "Should return nothing if removed" ); - // TODO non standard moz_matches_selector should we even support? - /* Tests needed for: insert_adjacent_element insert_adjacent_text @@ -160,7 +174,7 @@ fn element() { assert_eq!( element.inner_html(), "<strong>Hey!</strong><em>Web!</em>", - "Should return HTML conent" + "Should return HTML content" ); assert_eq!( element.query_selector_all("strong").unwrap().length(), |