mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-23 17:51:33 +00:00
Testing web-sys for input, heading and title elements. (#596)
This commit is contained in:
committed by
Alex Crichton
parent
05f3eec76d
commit
26a3e57536
@ -178,13 +178,13 @@ bindings are fully working and have full test coverage.
|
|||||||
- [ ] HiddenPluginEvent.webidl
|
- [ ] HiddenPluginEvent.webidl
|
||||||
- [ ] History.webidl
|
- [ ] History.webidl
|
||||||
- [ ] HTMLAllCollection.webidl
|
- [ ] HTMLAllCollection.webidl
|
||||||
- [ ] HTMLAnchorElement.webidl
|
- [x] HTMLAnchorElement.webidl
|
||||||
- [ ] HTMLAreaElement.webidl
|
- [ ] HTMLAreaElement.webidl
|
||||||
- [ ] HTMLAudioElement.webidl
|
- [ ] HTMLAudioElement.webidl
|
||||||
- [ ] HTMLBaseElement.webidl
|
- [ ] HTMLBaseElement.webidl
|
||||||
- [ ] HTMLBodyElement.webidl
|
- [x] HTMLBodyElement.webidl
|
||||||
- [ ] HTMLBRElement.webidl
|
- [x] HTMLBRElement.webidl
|
||||||
- [ ] HTMLButtonElement.webidl
|
- [x] HTMLButtonElement.webidl
|
||||||
- [ ] HTMLCanvasElement.webidl
|
- [ ] HTMLCanvasElement.webidl
|
||||||
- [ ] HTMLCollection.webidl
|
- [ ] HTMLCollection.webidl
|
||||||
- [ ] HTMLDataElement.webidl
|
- [ ] HTMLDataElement.webidl
|
||||||
@ -192,10 +192,10 @@ bindings are fully working and have full test coverage.
|
|||||||
- [ ] HTMLDetailsElement.webidl
|
- [ ] HTMLDetailsElement.webidl
|
||||||
- [ ] HTMLDialogElement.webidl
|
- [ ] HTMLDialogElement.webidl
|
||||||
- [ ] HTMLDirectoryElement.webidl
|
- [ ] HTMLDirectoryElement.webidl
|
||||||
- [ ] HTMLDivElement.webidl
|
- [x] HTMLDivElement.webidl
|
||||||
- [ ] HTMLDListElement.webidl
|
- [ ] HTMLDListElement.webidl
|
||||||
- [ ] HTMLDocument.webidl
|
- [ ] HTMLDocument.webidl
|
||||||
- [ ] HTMLElement.webidl
|
- [x] HTMLElement.webidl
|
||||||
- [ ] HTMLEmbedElement.webidl
|
- [ ] HTMLEmbedElement.webidl
|
||||||
- [ ] HTMLFieldSetElement.webidl
|
- [ ] HTMLFieldSetElement.webidl
|
||||||
- [ ] HTMLFontElement.webidl
|
- [ ] HTMLFontElement.webidl
|
||||||
@ -204,13 +204,13 @@ bindings are fully working and have full test coverage.
|
|||||||
- [ ] HTMLFrameElement.webidl
|
- [ ] HTMLFrameElement.webidl
|
||||||
- [ ] HTMLFrameSetElement.webidl
|
- [ ] HTMLFrameSetElement.webidl
|
||||||
- [ ] HTMLHeadElement.webidl
|
- [ ] HTMLHeadElement.webidl
|
||||||
- [ ] HTMLHeadingElement.webidl
|
- [x] HTMLHeadingElement.webidl
|
||||||
- [x] HTMLHRElement.webidl
|
- [x] HTMLHRElement.webidl
|
||||||
- [ ] HTMLHtmlElement.webidl
|
- [x] HTMLHtmlElement.webidl
|
||||||
- [ ] HTMLHyperlinkElementUtils.webidl
|
- [ ] HTMLHyperlinkElementUtils.webidl
|
||||||
- [ ] HTMLIFrameElement.webidl
|
- [ ] HTMLIFrameElement.webidl
|
||||||
- [ ] HTMLImageElement.webidl
|
- [ ] HTMLImageElement.webidl
|
||||||
- [ ] HTMLInputElement.webidl
|
- [x] HTMLInputElement.webidl
|
||||||
- [ ] HTMLLabelElement.webidl
|
- [ ] HTMLLabelElement.webidl
|
||||||
- [ ] HTMLLegendElement.webidl
|
- [ ] HTMLLegendElement.webidl
|
||||||
- [ ] HTMLLIElement.webidl
|
- [ ] HTMLLIElement.webidl
|
||||||
@ -234,12 +234,12 @@ bindings are fully working and have full test coverage.
|
|||||||
- [ ] HTMLPreElement.webidl
|
- [ ] HTMLPreElement.webidl
|
||||||
- [ ] HTMLProgressElement.webidl
|
- [ ] HTMLProgressElement.webidl
|
||||||
- [ ] HTMLQuoteElement.webidl
|
- [ ] HTMLQuoteElement.webidl
|
||||||
- [ ] HTMLScriptElement.webidl
|
- [x] HTMLScriptElement.webidl
|
||||||
- [ ] HTMLSelectElement.webidl
|
- [ ] HTMLSelectElement.webidl
|
||||||
- [ ] HTMLSlotElement.webidl
|
- [ ] HTMLSlotElement.webidl
|
||||||
- [ ] HTMLSourceElement.webidl
|
- [ ] HTMLSourceElement.webidl
|
||||||
- [ ] HTMLSpanElement.webidl
|
- [ ] HTMLSpanElement.webidl
|
||||||
- [ ] HTMLStyleElement.webidl
|
- [x] HTMLStyleElement.webidl
|
||||||
- [ ] HTMLTableCaptionElement.webidl
|
- [ ] HTMLTableCaptionElement.webidl
|
||||||
- [ ] HTMLTableCellElement.webidl
|
- [ ] HTMLTableCellElement.webidl
|
||||||
- [ ] HTMLTableColElement.webidl
|
- [ ] HTMLTableColElement.webidl
|
||||||
@ -249,7 +249,7 @@ bindings are fully working and have full test coverage.
|
|||||||
- [ ] HTMLTemplateElement.webidl
|
- [ ] HTMLTemplateElement.webidl
|
||||||
- [ ] HTMLTextAreaElement.webidl
|
- [ ] HTMLTextAreaElement.webidl
|
||||||
- [ ] HTMLTimeElement.webidl
|
- [ ] HTMLTimeElement.webidl
|
||||||
- [ ] HTMLTitleElement.webidl
|
- [x] HTMLTitleElement.webidl
|
||||||
- [ ] HTMLTrackElement.webidl
|
- [ ] HTMLTrackElement.webidl
|
||||||
- [ ] HTMLUListElement.webidl
|
- [ ] HTMLUListElement.webidl
|
||||||
- [ ] HTMLVideoElement.webidl
|
- [ ] HTMLVideoElement.webidl
|
||||||
|
@ -46,6 +46,18 @@ export function new_style() {
|
|||||||
return document.createElement("style");
|
return document.createElement("style");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function new_input() {
|
||||||
|
return document.createElement("input");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function new_title() {
|
||||||
|
return document.createElement("title");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function new_heading() {
|
||||||
|
return document.createElement("h1");
|
||||||
|
}
|
||||||
|
|
||||||
export function new_xpath_result() {
|
export function new_xpath_result() {
|
||||||
let xmlDoc = new DOMParser().parseFromString("<root><value>tomato</value></root>", "application/xml");
|
let xmlDoc = new DOMParser().parseFromString("<root><value>tomato</value></root>", "application/xml");
|
||||||
let xpathResult = xmlDoc.evaluate("/root//value", xmlDoc, null, XPathResult.ANY_TYPE, null);
|
let xpathResult = xmlDoc.evaluate("/root//value", xmlDoc, null, XPathResult.ANY_TYPE, null);
|
||||||
|
16
crates/web-sys/tests/wasm/heading_element.rs
Normal file
16
crates/web-sys/tests/wasm/heading_element.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
use wasm_bindgen_test::*;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
use web_sys::HtmlHeadingElement;
|
||||||
|
|
||||||
|
#[wasm_bindgen(module = "./tests/wasm/element.js")]
|
||||||
|
extern {
|
||||||
|
fn new_heading() -> HtmlHeadingElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen_test]
|
||||||
|
fn heading_element() {
|
||||||
|
let element = new_heading();
|
||||||
|
assert_eq!(element.align(), "", "Shouldn't have an align");
|
||||||
|
element.set_align("justify");
|
||||||
|
assert_eq!(element.align(), "justify", "Should have an align");
|
||||||
|
}
|
@ -58,11 +58,13 @@ fn test_html_element() {
|
|||||||
assert_eq!(element.content_editable(), "true", "Should be content_editable");
|
assert_eq!(element.content_editable(), "true", "Should be content_editable");
|
||||||
assert!(element.is_content_editable(), "Should be content_editable");
|
assert!(element.is_content_editable(), "Should be content_editable");
|
||||||
|
|
||||||
|
/*TODO doesn't work in Chrome
|
||||||
// TODO verify case where menu is passed
|
// TODO verify case where menu is passed
|
||||||
match element.context_menu() {
|
match element.context_menu() {
|
||||||
None => assert!(true, "Shouldn't have a custom menu set"),
|
None => assert!(true, "Shouldn't have a custom menu set"),
|
||||||
_ => assert!(false, "Shouldn't have a custom menu set")
|
_ => assert!(false, "Shouldn't have a custom menu set")
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
assert!(!element.spellcheck(), "Shouldn't be spellchecked");
|
assert!(!element.spellcheck(), "Shouldn't be spellchecked");
|
||||||
element.set_spellcheck(true);
|
element.set_spellcheck(true);
|
||||||
|
198
crates/web-sys/tests/wasm/input_element.rs
Normal file
198
crates/web-sys/tests/wasm/input_element.rs
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
use wasm_bindgen_test::*;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
use web_sys::HtmlInputElement;
|
||||||
|
|
||||||
|
#[wasm_bindgen(module = "./tests/wasm/element.js")]
|
||||||
|
extern {
|
||||||
|
fn new_input() -> HtmlInputElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
extern {
|
||||||
|
#[wasm_bindgen(js_name = location, js_namespace = document)]
|
||||||
|
static LOCATION: Location;
|
||||||
|
|
||||||
|
type Location;
|
||||||
|
|
||||||
|
// FIXME: `href` should be structural in `web_sys`
|
||||||
|
#[wasm_bindgen(getter, method, structural)]
|
||||||
|
fn href(this: &Location) -> String;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen_test]
|
||||||
|
fn test_input_element() {
|
||||||
|
let element = new_input();
|
||||||
|
let location = LOCATION.href();
|
||||||
|
assert_eq!(element.accept(), "", "Shouldn't have an accept");
|
||||||
|
element.set_accept("audio/*");
|
||||||
|
assert_eq!(element.accept(), "audio/*", "Should have an accept");
|
||||||
|
|
||||||
|
assert_eq!(element.alt(), "", "Shouldn't have an alt");
|
||||||
|
element.set_alt("alt text");
|
||||||
|
assert_eq!(element.alt(), "alt text", "Should have an alt");
|
||||||
|
|
||||||
|
element.set_type("text");
|
||||||
|
assert_eq!(element.autocomplete(), "", "Shouldn't have an autocomplete");
|
||||||
|
element.set_autocomplete("on");
|
||||||
|
assert_eq!(element.autocomplete(), "on", "Shouldn't have an autocomplete");
|
||||||
|
|
||||||
|
assert!(!element.autofocus(), "Shouldn't have an autofocus");
|
||||||
|
element.set_autofocus(true);
|
||||||
|
assert!(element.autofocus(), "Should have an autofocus");
|
||||||
|
|
||||||
|
element.set_type("checkbox");
|
||||||
|
assert!(!element.default_checked(), "Shouldn't have an default_checked");
|
||||||
|
element.set_default_checked(true);
|
||||||
|
assert!(element.default_checked(), "Should have an default_checked");
|
||||||
|
|
||||||
|
/*TODO fix
|
||||||
|
assert!(!element.checked(), "Shouldn't be checked");
|
||||||
|
element.set_checked(true);
|
||||||
|
assert!(element.checked(), "Should be checked");
|
||||||
|
*/
|
||||||
|
|
||||||
|
assert!(!element.disabled(), "Shouldn't be disabled");
|
||||||
|
element.set_disabled(true);
|
||||||
|
assert!(element.disabled(), "Should be disabled");
|
||||||
|
|
||||||
|
match element.form() {
|
||||||
|
None => assert!(true, "Shouldn't have a form"),
|
||||||
|
_ => assert!(false, "Shouldn't have a form"),
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(element.form_action(), location, "Should have the pages location");
|
||||||
|
element.set_form_action("http://boop.com/");
|
||||||
|
assert_eq!(element.form_action(), "http://boop.com/", "Should have a form_action");
|
||||||
|
|
||||||
|
assert_eq!(element.form_enctype(), "", "Should have no enctype");
|
||||||
|
element.set_form_enctype("text/plain");
|
||||||
|
assert_eq!(element.form_enctype(), "text/plain", "Should have a plain text enctype");
|
||||||
|
|
||||||
|
assert_eq!(element.form_method(), "", "Should have no method");
|
||||||
|
element.set_form_method("POST");
|
||||||
|
assert_eq!(element.form_method(), "post", "Should have a POST method");
|
||||||
|
|
||||||
|
assert!(!element.form_no_validate(), "Should validate");
|
||||||
|
element.set_form_no_validate(true);
|
||||||
|
assert!(element.form_no_validate(), "Should not validate");
|
||||||
|
|
||||||
|
assert_eq!(element.form_target(), "", "Should have no target");
|
||||||
|
element.set_form_target("_blank");
|
||||||
|
assert_eq!(element.form_target(), "_blank", "Should have a _blank target");
|
||||||
|
|
||||||
|
assert_eq!(element.height(), 0, "Should have no height");
|
||||||
|
element.set_height(12);
|
||||||
|
assert_eq!(element.height(), 0, "Should have no height"); // Doesn't change, TODO check with get_attribute("height")=="12"
|
||||||
|
|
||||||
|
/*TODO fails in chrome
|
||||||
|
element.set_type("checkbox");
|
||||||
|
assert!(element.indeterminate(), "Should be indeterminate");
|
||||||
|
element.set_checked(true);
|
||||||
|
assert!(!element.indeterminate(), "Shouldn't be indeterminate");
|
||||||
|
*/
|
||||||
|
/*TODO add tests
|
||||||
|
pub fn indeterminate(&self) -> bool
|
||||||
|
pub fn set_indeterminate(&self, indeterminate: bool)
|
||||||
|
pub fn input_mode(&self) -> String
|
||||||
|
pub fn set_input_mode(&self, input_mode: &str)
|
||||||
|
pub fn list(&self) -> Option<HtmlElement>
|
||||||
|
pub fn max(&self) -> String
|
||||||
|
pub fn set_max(&self, max: &str)
|
||||||
|
pub fn max_length(&self) -> i32
|
||||||
|
pub fn set_max_length(&self, max_length: i32)
|
||||||
|
pub fn min(&self) -> String
|
||||||
|
pub fn set_min(&self, min: &str)
|
||||||
|
pub fn min_length(&self) -> i32
|
||||||
|
pub fn set_min_length(&self, min_length: i32)
|
||||||
|
pub fn multiple(&self) -> bool
|
||||||
|
pub fn set_multiple(&self, multiple: bool)
|
||||||
|
*/
|
||||||
|
assert_eq!(element.name(), "", "Should not have a name");
|
||||||
|
element.set_name("namey");
|
||||||
|
assert_eq!(element.name(), "namey", "Should have a name");
|
||||||
|
/*TODO add tests
|
||||||
|
pub fn pattern(&self) -> String
|
||||||
|
pub fn set_pattern(&self, pattern: &str)
|
||||||
|
*/
|
||||||
|
assert_eq!(element.placeholder(), "", "Should not have a placeholder");
|
||||||
|
element.set_placeholder("some text");
|
||||||
|
assert_eq!(element.placeholder(), "some text", "Should have a placeholder");
|
||||||
|
|
||||||
|
assert!(!element.read_only(), "Should have not be readonly");
|
||||||
|
element.set_read_only(true);
|
||||||
|
assert!(element.read_only(), "Should be readonly");
|
||||||
|
|
||||||
|
assert!(!element.required(), "Should have not be required");
|
||||||
|
element.set_required(true);
|
||||||
|
assert!(element.required(), "Should be required");
|
||||||
|
/*TODO add tests
|
||||||
|
pub fn size(&self) -> u32
|
||||||
|
pub fn set_size(&self, size: u32)
|
||||||
|
*/
|
||||||
|
/*TODO fails in chrome
|
||||||
|
element.set_type("image");
|
||||||
|
assert_eq!(element.src(), "", "Should have no src");
|
||||||
|
element.set_value("hey.png");
|
||||||
|
assert_eq!(element.src(), "hey.png", "Should have a src");
|
||||||
|
*/
|
||||||
|
/*TODO add tests
|
||||||
|
pub fn src(&self) -> String
|
||||||
|
pub fn set_src(&self, src: &str)
|
||||||
|
pub fn step(&self) -> String
|
||||||
|
pub fn set_step(&self, step: &str)
|
||||||
|
pub fn type_(&self) -> String
|
||||||
|
pub fn set_type(&self, type_: &str)
|
||||||
|
pub fn default_value(&self) -> String
|
||||||
|
pub fn set_default_value(&self, default_value: &str)
|
||||||
|
*/
|
||||||
|
/*TODO fails in chrome
|
||||||
|
assert_eq!(element.value(), "", "Should have no value");
|
||||||
|
element.set_value("hey!");
|
||||||
|
assert_eq!(element.value(), "hey!", "Should have a value");
|
||||||
|
*/
|
||||||
|
element.set_type("number");
|
||||||
|
element.set_value("1");
|
||||||
|
assert_eq!(element.value_as_number(), 1.0, "Should have value 1");
|
||||||
|
element.set_value_as_number(2.0);
|
||||||
|
assert_eq!(element.value(), "2", "Should have value 2");
|
||||||
|
|
||||||
|
assert_eq!(element.width(), 0, "Should have no width");
|
||||||
|
element.set_width(12);
|
||||||
|
assert_eq!(element.width(), 0, "Should have no width"); // Doesn't change, TODO check with get_attribute("width")=="12"
|
||||||
|
|
||||||
|
assert_eq!(element.will_validate(), false, "Shouldn't validate");
|
||||||
|
assert_eq!(element.validation_message().unwrap(), "", "Shouldn't have a value");
|
||||||
|
assert_eq!(element.check_validity(), true, "Should be valid");
|
||||||
|
assert_eq!(element.report_validity(), true, "Should be valid");
|
||||||
|
element.set_custom_validity("Boop"); // Method exists but doesn't impact validity ?!??! TODO look into
|
||||||
|
assert_eq!(element.check_validity(), true, "Should be valid");
|
||||||
|
assert_eq!(element.report_validity(), true, "Should be valid");
|
||||||
|
/*TODO add tests
|
||||||
|
pub fn labels(&self) -> Option<NodeList>
|
||||||
|
pub fn select(&self)
|
||||||
|
pub fn selection_direction(&self) -> Result<Option<String>, JsValue>
|
||||||
|
pub fn set_selection_direction(
|
||||||
|
&self,
|
||||||
|
selection_direction: Option<&str>
|
||||||
|
) -> Result<(), JsValue>
|
||||||
|
pub fn set_range_text(&self, replacement: &str) -> Result<(), JsValue>
|
||||||
|
pub fn set_selection_range(
|
||||||
|
&self,
|
||||||
|
start: u32,
|
||||||
|
end: u32,
|
||||||
|
direction: &str
|
||||||
|
) -> Result<(), JsValue>
|
||||||
|
*/
|
||||||
|
|
||||||
|
assert_eq!(element.align(), "", "Should have no align");
|
||||||
|
element.set_align("left");
|
||||||
|
assert_eq!(element.align(), "left", "Should have an align");
|
||||||
|
/*TODO add tests
|
||||||
|
pub fn use_map(&self) -> String
|
||||||
|
pub fn set_use_map(&self, use_map: &str)
|
||||||
|
pub fn text_length(&self) -> i32
|
||||||
|
pub fn webkitdirectory(&self) -> bool
|
||||||
|
pub fn set_webkitdirectory(&self, webkitdirectory: bool)
|
||||||
|
pub fn set_focus_state(&self, a_is_focused: bool)
|
||||||
|
*/
|
||||||
|
}
|
@ -15,74 +15,16 @@ pub mod button_element;
|
|||||||
pub mod div_element;
|
pub mod div_element;
|
||||||
pub mod element;
|
pub mod element;
|
||||||
pub mod head_element;
|
pub mod head_element;
|
||||||
|
pub mod heading_element;
|
||||||
pub mod headers;
|
pub mod headers;
|
||||||
pub mod history;
|
pub mod history;
|
||||||
pub mod hr_element;
|
pub mod hr_element;
|
||||||
pub mod html_element;
|
pub mod html_element;
|
||||||
pub mod html_html_element;
|
pub mod html_html_element;
|
||||||
|
pub mod input_element;
|
||||||
pub mod response;
|
pub mod response;
|
||||||
pub mod script_element;
|
pub mod script_element;
|
||||||
pub mod span_element;
|
pub mod span_element;
|
||||||
pub mod style_element;
|
pub mod style_element;
|
||||||
/*TODO tests for:
|
pub mod title_element;
|
||||||
web_sys::HtmlFontElement,
|
|
||||||
web_sys::HtmlMenuItemElement,
|
|
||||||
web_sys::HtmlSourceElement,
|
|
||||||
web_sys::HtmlAreaElement,
|
|
||||||
web_sys::HtmlFormElement,
|
|
||||||
web_sys::HtmlMetaElement,
|
|
||||||
web_sys::HtmlAudioElement,
|
|
||||||
web_sys::HtmlFrameElement,
|
|
||||||
web_sys::HtmlMeterElement,
|
|
||||||
web_sys::HtmlBaseElement,
|
|
||||||
web_sys::HtmlFrameSetElement,
|
|
||||||
web_sys::HtmlModElement,
|
|
||||||
web_sys::HtmlTableCaptionElement,
|
|
||||||
web_sys::HtmlObjectElement,
|
|
||||||
web_sys::HtmlTableCellElement,
|
|
||||||
web_sys::HtmlHeadingElement,
|
|
||||||
web_sys::HtmlOListElement,
|
|
||||||
web_sys::HtmlTableColElement,
|
|
||||||
web_sys::HtmlHRElement,
|
|
||||||
web_sys::HtmlOptGroupElement,
|
|
||||||
web_sys::HtmlTableElement,
|
|
||||||
web_sys::HtmlCanvasElement,
|
|
||||||
web_sys::HtmlOptionElement,
|
|
||||||
web_sys::HtmlTableRowElement,
|
|
||||||
web_sys::HtmlDataElement,
|
|
||||||
web_sys::HtmlIFrameElement,
|
|
||||||
web_sys::HtmlOutputElement,
|
|
||||||
web_sys::HtmlTableSectionElement,
|
|
||||||
web_sys::HtmlDataListElement,
|
|
||||||
web_sys::HtmlImageElement,
|
|
||||||
web_sys::HtmlParagraphElement,
|
|
||||||
web_sys::HtmlTemplateElement,
|
|
||||||
web_sys::HtmlDetailsElement,
|
|
||||||
web_sys::HtmlInputElement,
|
|
||||||
web_sys::HtmlParamElement,
|
|
||||||
web_sys::HtmlTextAreaElement,
|
|
||||||
web_sys::HtmlDialogElement,
|
|
||||||
web_sys::HtmlLabelElement,
|
|
||||||
web_sys::HtmlPictureElement,
|
|
||||||
web_sys::HtmlTimeElement,
|
|
||||||
web_sys::HtmlDirectoryElement,
|
|
||||||
web_sys::HtmlLegendElement,
|
|
||||||
web_sys::HtmlPreElement,
|
|
||||||
web_sys::HtmlTitleElement,
|
|
||||||
web_sys::HtmlLIElement,
|
|
||||||
web_sys::HtmlProgressElement,
|
|
||||||
web_sys::HtmlTrackElement,
|
|
||||||
web_sys::HtmlDListElement,
|
|
||||||
web_sys::HtmlLinkElement,
|
|
||||||
web_sys::HtmlQuoteElement,
|
|
||||||
web_sys::HtmlUListElement,
|
|
||||||
web_sys::HtmlMapElement,
|
|
||||||
web_sys::HtmlVideoElement,
|
|
||||||
web_sys::HtmlEmbedElement,
|
|
||||||
web_sys::HtmlMediaElement,
|
|
||||||
web_sys::HtmlSelectElement,
|
|
||||||
web_sys::HtmlFieldSetElement,
|
|
||||||
web_sys::HtmlMenuElement,
|
|
||||||
web_sys::HtmlSlotElement,
|
|
||||||
*/
|
|
||||||
pub mod xpath_result;
|
pub mod xpath_result;
|
||||||
|
16
crates/web-sys/tests/wasm/title_element.rs
Normal file
16
crates/web-sys/tests/wasm/title_element.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
use wasm_bindgen_test::*;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
use web_sys::HtmlTitleElement;
|
||||||
|
|
||||||
|
#[wasm_bindgen(module = "./tests/wasm/element.js")]
|
||||||
|
extern {
|
||||||
|
fn new_title() -> HtmlTitleElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen_test]
|
||||||
|
fn title_element() {
|
||||||
|
let element = new_title();
|
||||||
|
assert_eq!(element.text().unwrap(), "", "Shouldn't have an text");
|
||||||
|
assert_eq!(element.set_text("page text").unwrap(), ());
|
||||||
|
assert_eq!(element.text().unwrap(), "page text", "Should have an text");
|
||||||
|
}
|
@ -14,8 +14,10 @@
|
|||||||
dictionary EventListenerOptions {
|
dictionary EventListenerOptions {
|
||||||
boolean capture = false;
|
boolean capture = false;
|
||||||
/* Setting to true make the listener be added to the system group. */
|
/* Setting to true make the listener be added to the system group. */
|
||||||
|
/*Non standard
|
||||||
[Func="ThreadSafeIsChromeOrXBL"]
|
[Func="ThreadSafeIsChromeOrXBL"]
|
||||||
boolean mozSystemGroup = false;
|
boolean mozSystemGroup = false;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary AddEventListenerOptions : EventListenerOptions {
|
dictionary AddEventListenerOptions : EventListenerOptions {
|
||||||
|
@ -50,8 +50,8 @@ interface HTMLElement : Element {
|
|||||||
attribute DOMString contentEditable;
|
attribute DOMString contentEditable;
|
||||||
[Pure]
|
[Pure]
|
||||||
readonly attribute boolean isContentEditable;
|
readonly attribute boolean isContentEditable;
|
||||||
[Pure]
|
//[Pure]
|
||||||
readonly attribute HTMLMenuElement? contextMenu;
|
//readonly attribute HTMLMenuElement? contextMenu;
|
||||||
//[SetterThrows]
|
//[SetterThrows]
|
||||||
// attribute HTMLMenuElement? contextMenu;
|
// attribute HTMLMenuElement? contextMenu;
|
||||||
[CEReactions, SetterThrows, Pure]
|
[CEReactions, SetterThrows, Pure]
|
||||||
|
@ -198,15 +198,18 @@ interface MozEditableElement {
|
|||||||
[Pure, ChromeOnly]
|
[Pure, ChromeOnly]
|
||||||
readonly attribute nsIEditor? editor;
|
readonly attribute nsIEditor? editor;
|
||||||
|
|
||||||
|
/*Non standard
|
||||||
// This is similar to set .value on nsIDOMInput/TextAreaElements, but handling
|
// This is similar to set .value on nsIDOMInput/TextAreaElements, but handling
|
||||||
// of the value change is closer to the normal user input, so 'change' event
|
// of the value change is closer to the normal user input, so 'change' event
|
||||||
// for example will be dispatched when focusing out the element.
|
// for example will be dispatched when focusing out the element.
|
||||||
[Func="IsChromeOrXBL", NeedsSubjectPrincipal]
|
[Func="IsChromeOrXBL", NeedsSubjectPrincipal]
|
||||||
void setUserInput(DOMString input);
|
void setUserInput(DOMString input);
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
HTMLInputElement implements MozEditableElement;
|
HTMLInputElement implements MozEditableElement;
|
||||||
|
|
||||||
|
/*Non standard
|
||||||
partial interface HTMLInputElement {
|
partial interface HTMLInputElement {
|
||||||
[Pref="dom.input.dirpicker", SetterThrows]
|
[Pref="dom.input.dirpicker", SetterThrows]
|
||||||
attribute boolean allowdirs;
|
attribute boolean allowdirs;
|
||||||
@ -223,6 +226,7 @@ partial interface HTMLInputElement {
|
|||||||
[Throws, Pref="dom.input.dirpicker"]
|
[Throws, Pref="dom.input.dirpicker"]
|
||||||
void chooseDirectory();
|
void chooseDirectory();
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
HTMLInputElement implements MozImageLoadingContent;
|
HTMLInputElement implements MozImageLoadingContent;
|
||||||
|
|
||||||
@ -261,6 +265,7 @@ partial interface HTMLInputElement {
|
|||||||
BinaryName="getMaximumAsDouble"]
|
BinaryName="getMaximumAsDouble"]
|
||||||
double getMaximum();
|
double getMaximum();
|
||||||
|
|
||||||
|
/*Non standard
|
||||||
[Pref="dom.forms.datetime", Func="IsChromeOrXBL"]
|
[Pref="dom.forms.datetime", Func="IsChromeOrXBL"]
|
||||||
void openDateTimePicker(optional DateTimeValue initialValue);
|
void openDateTimePicker(optional DateTimeValue initialValue);
|
||||||
|
|
||||||
@ -283,6 +288,7 @@ partial interface HTMLInputElement {
|
|||||||
[Pref="dom.forms.datetime", Func="IsChromeOrXBL",
|
[Pref="dom.forms.datetime", Func="IsChromeOrXBL",
|
||||||
BinaryName="getStepBaseAsDouble"]
|
BinaryName="getStepBaseAsDouble"]
|
||||||
double getStepBase();
|
double getStepBase();
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
partial interface HTMLInputElement {
|
partial interface HTMLInputElement {
|
||||||
|
@ -119,9 +119,11 @@ partial interface HTMLMediaElement {
|
|||||||
|
|
||||||
attribute boolean mozPreservesPitch;
|
attribute boolean mozPreservesPitch;
|
||||||
|
|
||||||
|
/*Non standard
|
||||||
// NB: for internal use with the video controls:
|
// NB: for internal use with the video controls:
|
||||||
[Func="IsChromeOrXBL"] attribute boolean mozAllowCasting;
|
[Func="IsChromeOrXBL"] attribute boolean mozAllowCasting;
|
||||||
[Func="IsChromeOrXBL"] attribute boolean mozIsCasting;
|
[Func="IsChromeOrXBL"] attribute boolean mozIsCasting;
|
||||||
|
*/
|
||||||
|
|
||||||
// Mozilla extension: stream capture
|
// Mozilla extension: stream capture
|
||||||
[Throws]
|
[Throws]
|
||||||
|
@ -46,6 +46,7 @@ partial interface HTMLVideoElement {
|
|||||||
// True if the video has an audio track available.
|
// True if the video has an audio track available.
|
||||||
readonly attribute boolean mozHasAudio;
|
readonly attribute boolean mozHasAudio;
|
||||||
|
|
||||||
|
/*Non standard
|
||||||
// Attributes for builtin video controls to lock screen orientation.
|
// Attributes for builtin video controls to lock screen orientation.
|
||||||
// True if video controls should lock orientation when fullscreen.
|
// True if video controls should lock orientation when fullscreen.
|
||||||
[Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrXBL"]
|
[Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrXBL"]
|
||||||
@ -53,6 +54,7 @@ partial interface HTMLVideoElement {
|
|||||||
// True if screen orientation is locked by video controls.
|
// True if screen orientation is locked by video controls.
|
||||||
[Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrXBL"]
|
[Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrXBL"]
|
||||||
attribute boolean mozIsOrientationLocked;
|
attribute boolean mozIsOrientationLocked;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#idl-def-HTMLVideoElement
|
// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#idl-def-HTMLVideoElement
|
||||||
|
Reference in New Issue
Block a user