Add unit test for HtmlHrElement web_sys binding (#591)

This commit is contained in:
Tyler Wilcock 2018-07-30 20:25:48 -05:00 committed by Alex Crichton
parent 05d3b934c8
commit c971620039
4 changed files with 31 additions and 2 deletions

View File

@ -205,7 +205,7 @@ bindings are fully working and have full test coverage.
- [ ] HTMLFrameSetElement.webidl - [ ] HTMLFrameSetElement.webidl
- [ ] HTMLHeadElement.webidl - [ ] HTMLHeadElement.webidl
- [ ] HTMLHeadingElement.webidl - [ ] HTMLHeadingElement.webidl
- [ ] HTMLHRElement.webidl - [x] HTMLHRElement.webidl
- [ ] HTMLHtmlElement.webidl - [ ] HTMLHtmlElement.webidl
- [ ] HTMLHyperlinkElementUtils.webidl - [ ] HTMLHyperlinkElementUtils.webidl
- [ ] HTMLIFrameElement.webidl - [ ] HTMLIFrameElement.webidl
@ -647,7 +647,7 @@ bindings are fully working and have full test coverage.
- [ ] XPathEvaluator.webidl - [ ] XPathEvaluator.webidl
- [ ] XPathExpression.webidl - [ ] XPathExpression.webidl
- [ ] XPathNSResolver.webidl - [ ] XPathNSResolver.webidl
- [ ] XPathResult.webidl - [x] XPathResult.webidl
- [ ] XSLTProcessor.webidl - [ ] XSLTProcessor.webidl
- [ ] README.md - [ ] README.md
- [ ] WaveShaperNode.webidl - [ ] WaveShaperNode.webidl

View File

@ -26,6 +26,10 @@ export function new_head() {
return document.createElement("head"); return document.createElement("head");
} }
export function new_hr() {
return document.createElement("hr");
}
export function new_html() { export function new_html() {
return document.createElement("html"); return document.createElement("html");
} }

View File

@ -0,0 +1,24 @@
use wasm_bindgen_test::*;
use wasm_bindgen::prelude::*;
use web_sys::HtmlHrElement;
#[wasm_bindgen(module = "./tests/wasm/element.js")]
extern {
fn new_hr() -> HtmlHrElement;
}
#[wasm_bindgen_test]
fn test_hr_element() {
let hr = new_hr();
hr.set_color("blue");
assert_eq!(hr.color(), "blue");
hr.set_width("128");
assert_eq!(hr.width(), "128");
hr.set_width("256");
assert_eq!(hr.width(), "256");
hr.set_no_shade(true);
assert_eq!(hr.no_shade(), true);
}

View File

@ -17,6 +17,7 @@ pub mod element;
pub mod head_element; pub mod head_element;
pub mod headers; pub mod headers;
pub mod history; pub mod history;
pub mod hr_element;
pub mod html_element; pub mod html_element;
pub mod html_html_element; pub mod html_html_element;
pub mod response; pub mod response;