mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 20:41:24 +00:00
Run rustfmt over everything
This commit is contained in:
@ -10,8 +10,8 @@ extern "C" {
|
||||
#[wasm_bindgen_test]
|
||||
fn element() {
|
||||
/* Tests needed for:
|
||||
namespace_uri
|
||||
*/
|
||||
namespace_uri
|
||||
*/
|
||||
let element = new_div();
|
||||
|
||||
assert_eq!(element.prefix(), None, "Shouldn't have a prefix");
|
||||
@ -52,17 +52,17 @@ fn element() {
|
||||
"Should return nothing if removed"
|
||||
);
|
||||
/* Tests needed for:
|
||||
get_attribute_ns
|
||||
*/
|
||||
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");
|
||||
*/
|
||||
// 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("title"), "Should not have a title");
|
||||
assert_eq!(
|
||||
@ -79,8 +79,8 @@ get_attribute_ns
|
||||
);
|
||||
assert!(!element.has_attribute("title"), "Should not have a title");
|
||||
/* Tests needed for:
|
||||
set_attribute_ns
|
||||
*/
|
||||
set_attribute_ns
|
||||
*/
|
||||
|
||||
assert!(!element.has_attributes(), "Should not have any attributes");
|
||||
assert_eq!(
|
||||
@ -95,10 +95,10 @@ set_attribute_ns
|
||||
"Should return nothing if removed"
|
||||
);
|
||||
/* Tests needed for:
|
||||
remove_attribute_ns
|
||||
has_attribure_ns
|
||||
closest
|
||||
*/
|
||||
remove_attribute_ns
|
||||
has_attribure_ns
|
||||
closest
|
||||
*/
|
||||
|
||||
assert_eq!(
|
||||
element.matches(".this-is-a-thing").unwrap(),
|
||||
@ -130,29 +130,29 @@ closest
|
||||
// TODO non standard moz_matches_selector should we even support?
|
||||
|
||||
/* Tests needed for:
|
||||
insert_adjacent_element
|
||||
insert_adjacent_text
|
||||
set_pointer_capture
|
||||
release_pointer_capture
|
||||
has_pointer_capture
|
||||
set_capture
|
||||
release_capture
|
||||
scroll_top
|
||||
set_scroll_top
|
||||
scroll_left
|
||||
set_scroll_left
|
||||
scroll_width
|
||||
scroll_height
|
||||
scroll,
|
||||
scroll_to
|
||||
scroll_by
|
||||
client_top
|
||||
client_left
|
||||
client_width
|
||||
client_height
|
||||
scroll_top_max
|
||||
scroll_left_max
|
||||
*/
|
||||
insert_adjacent_element
|
||||
insert_adjacent_text
|
||||
set_pointer_capture
|
||||
release_pointer_capture
|
||||
has_pointer_capture
|
||||
set_capture
|
||||
release_capture
|
||||
scroll_top
|
||||
set_scroll_top
|
||||
scroll_left
|
||||
set_scroll_left
|
||||
scroll_width
|
||||
scroll_height
|
||||
scroll,
|
||||
scroll_to
|
||||
scroll_by
|
||||
client_top
|
||||
client_left
|
||||
client_width
|
||||
client_height
|
||||
scroll_top_max
|
||||
scroll_left_max
|
||||
*/
|
||||
assert_eq!(element.inner_html(), "", "Should return no content");
|
||||
element.set_inner_html("<strong>Hey!</strong><em>Web!</em>");
|
||||
assert_eq!(
|
||||
@ -173,10 +173,10 @@ scroll_left_max
|
||||
assert_eq!(element.inner_html(), "", "Should return no content");
|
||||
|
||||
/* Tests needed for:
|
||||
outer_html
|
||||
set_outer_html
|
||||
insert_adjacent_html
|
||||
*/
|
||||
outer_html
|
||||
set_outer_html
|
||||
insert_adjacent_html
|
||||
*/
|
||||
|
||||
assert!(
|
||||
element.query_selector(".none-existant").unwrap().is_none(),
|
||||
@ -191,9 +191,9 @@ insert_adjacent_html
|
||||
"Should return no results"
|
||||
);
|
||||
/* Tests needed for:
|
||||
slot
|
||||
set_slot
|
||||
request_fullscreen
|
||||
request_pointer_lock
|
||||
*/
|
||||
slot
|
||||
set_slot
|
||||
request_fullscreen
|
||||
request_pointer_lock
|
||||
*/
|
||||
}
|
||||
|
@ -70,12 +70,12 @@ fn test_html_element() {
|
||||
assert!(element.is_content_editable(), "Should be content_editable");
|
||||
|
||||
/*TODO doesn't work in Chrome
|
||||
// TODO verify case where menu is passed
|
||||
match element.context_menu() {
|
||||
None => assert!(true, "Shouldn't have a custom menu set"),
|
||||
_ => assert!(false, "Shouldn't have a custom menu set")
|
||||
};
|
||||
*/
|
||||
// TODO verify case where menu is passed
|
||||
match element.context_menu() {
|
||||
None => assert!(true, "Shouldn't have a custom menu set"),
|
||||
_ => assert!(false, "Shouldn't have a custom menu set")
|
||||
};
|
||||
*/
|
||||
|
||||
// TODO: This test is also broken in Chrome (but not Firefox).
|
||||
// assert!(!element.spellcheck(), "Shouldn't be spellchecked");
|
||||
|
@ -53,10 +53,10 @@ fn test_input_element() {
|
||||
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.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);
|
||||
@ -114,29 +114,29 @@ fn test_input_element() {
|
||||
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)
|
||||
*/
|
||||
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)
|
||||
*/
|
||||
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!(
|
||||
@ -153,30 +153,30 @@ pub fn set_pattern(&self, pattern: &str)
|
||||
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)
|
||||
*/
|
||||
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");
|
||||
*/
|
||||
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)
|
||||
*/
|
||||
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");
|
||||
*/
|
||||
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");
|
||||
@ -199,31 +199,31 @@ pub fn set_default_value(&self, default_value: &str)
|
||||
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>
|
||||
*/
|
||||
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)
|
||||
*/
|
||||
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)
|
||||
*/
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ pub mod input_element;
|
||||
//pub mod menu_element;
|
||||
//pub mod menu_item_element;
|
||||
pub mod dom_point;
|
||||
pub mod indexeddb;
|
||||
pub mod location;
|
||||
pub mod meta_element;
|
||||
pub mod meter_element;
|
||||
@ -55,7 +56,6 @@ pub mod style_element;
|
||||
pub mod table_element;
|
||||
pub mod title_element;
|
||||
pub mod xpath_result;
|
||||
pub mod indexeddb;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn deref_works() {
|
||||
|
@ -8,7 +8,8 @@ fn test_option_element() {
|
||||
"option_value",
|
||||
false,
|
||||
true,
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
option.set_disabled(true);
|
||||
assert_eq!(
|
||||
|
Reference in New Issue
Block a user