From 8ec2fe5878e14af8298d1cd87a944c2984972425 Mon Sep 17 00:00:00 2001 From: Jovansonlee Cesar Date: Sun, 17 Nov 2024 17:04:26 +0800 Subject: [PATCH] fix: tests, prepare for 0.61.9 release --- Cargo.toml | 3 +-- crates/core/Cargo.toml | 2 +- crates/core/src/dom/events.rs | 8 ++------ crates/core/src/dom/util.rs | 6 +++--- crates/html-parser/Cargo.toml | 2 +- crates/macro/Cargo.toml | 2 +- justfile | 4 ++-- tests/dom_create_element_tests.rs | 1 - tests/dom_fragment_test.rs | 1 - tests/dom_insert_before_after_patches.rs | 1 - tests/dom_insert_patches.rs | 1 - tests/dom_keyed_subsequent_updates.rs | 1 - tests/dom_node_event_recycling.rs | 1 - tests/dom_passing_reordered_keyed_node.rs | 1 - tests/dom_patches_keyed.rs | 1 - tests/dom_patches_text_node.rs | 1 - tests/dom_remove_node_patches.rs | 1 - tests/dom_reordered_keyed_nodes.rs | 1 - tests/dom_replace_node_patches.rs | 1 - tests/dom_safe_html.rs | 1 - tests/dom_swap_nodes.rs | 1 - tests/dom_test_update.rs | 1 - tests/dom_updater_test.rs | 1 - tests/dom_updates_target_dom.rs | 1 - tests/dom_util_functions.rs | 1 - tests/test_fixtures.rs | 1 - 26 files changed, 11 insertions(+), 35 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 68e353ee8..cac380bcc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sauron" -version = "0.61.8" +version = "0.61.9" authors = [ "Jovansonlee Cesar " ] license = "MIT" description = "A versatile web framework and library for building client-side and/or server-side web applications" @@ -101,4 +101,3 @@ harness = false [[bench]] name = "bench_view_performance" harness = false - diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 59b955d3b..29ee492ba 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sauron-core" -version = "0.61.8" +version = "0.61.9" authors = [ "Jovansonlee Cesar " ] license = "MIT" description = "An html library for building client side webapps" diff --git a/crates/core/src/dom/events.rs b/crates/core/src/dom/events.rs index 754663640..bc4d81cc4 100644 --- a/crates/core/src/dom/events.rs +++ b/crates/core/src/dom/events.rs @@ -7,7 +7,6 @@ use crate::vdom; use crate::vdom::ComponentEventCallback; use crate::vdom::{Attribute, AttributeValue, EventCallback}; use wasm_bindgen::JsCast; -#[cfg(web_sys_unstable_apis)] pub use web_sys::ClipboardEvent; pub use web_sys::{ AnimationEvent, FocusEvent, HashChangeEvent, KeyboardEvent, MouseEvent, Selection, TouchEvent, @@ -332,8 +331,8 @@ impl InputEvent { /// create a native web event, with composed set to true pub fn create_web_event_composed() -> web_sys::Event { - let mut event_init = web_sys::EventInit::new(); - event_init.composed(true); + let event_init = web_sys::EventInit::new(); + event_init.set_composed(true); web_sys::Event::new_with_event_init_dict("input", &event_init).expect("event init") } } @@ -366,7 +365,6 @@ fn to_open(event: Event) -> bool { /// Note: paste event happens before the data is inserted into the target element /// therefore trying to access the data on the target element triggered from paste will get an /// empty text -#[cfg(web_sys_unstable_apis)] fn to_clipboard_event(event: Event) -> ClipboardEvent { event .as_web() @@ -416,9 +414,7 @@ declare_html_events! { on_submit => submit => to_webevent => web_sys::Event; on_input => input => to_input_event => InputEvent; on_checked => input => to_checked => bool; - #[cfg(web_sys_unstable_apis)] on_paste => paste => to_clipboard_event => ClipboardEvent; - #[cfg(web_sys_unstable_apis)] on_copy => copy => to_clipboard_event => ClipboardEvent; on_change => change => to_input_event => InputEvent; on_broadcast => broadcast => to_input_event => InputEvent; diff --git a/crates/core/src/dom/util.rs b/crates/core/src/dom/util.rs index af78d4c46..10a725ebd 100644 --- a/crates/core/src/dom/util.rs +++ b/crates/core/src/dom/util.rs @@ -55,9 +55,9 @@ pub fn now() -> f64 { /// scroll the browser to the top of the document pub fn scroll_window_to_top() { - let mut options = ScrollToOptions::new(); - options.top(0.0); - options.left(0.0); + let options = ScrollToOptions::new(); + options.set_top(0.0); + options.set_left(0.0); window().scroll_to_with_scroll_to_options(&options); } diff --git a/crates/html-parser/Cargo.toml b/crates/html-parser/Cargo.toml index 584d5804b..3fe9e8cfd 100644 --- a/crates/html-parser/Cargo.toml +++ b/crates/html-parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sauron-html-parser" -version = "0.61.8" +version = "0.61.9" edition = "2021" authors = [ "Jovansonlee Cesar " ] license = "MIT" diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index abf710398..f14e21530 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sauron-macro" -version = "0.61.8" +version = "0.61.9" authors = ["John-John Tedro ", "Jovansonlee Cesar "] license = "MIT" description = "An html library for building client side webapps" diff --git a/justfile b/justfile index c2cef196b..bb1864f7c 100644 --- a/justfile +++ b/justfile @@ -13,10 +13,10 @@ test-with-dom: wasm-test: - wasm-pack test --firefox --headless + RUSTFLAGS=--cfg=web_sys_unstable_apis wasm-pack test --firefox --headless wasm-test-with-features: - wasm-pack test --firefox --headless -- --no-default-features --features "with-dom with-node-macro custom_element" + RUSTFLAGS=--cfg=web_sys_unstable_apis wasm-pack test --firefox --headless -- --no-default-features --features "with-dom with-node-macro custom_element" test-all: test wasm-test diff --git a/tests/dom_create_element_tests.rs b/tests/dom_create_element_tests.rs index fba095473..00eddc93d 100644 --- a/tests/dom_create_element_tests.rs +++ b/tests/dom_create_element_tests.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::{html::attributes::replace, *}; use std::{cell::Cell, rc::Rc}; use test_fixtures::simple_program; diff --git a/tests/dom_fragment_test.rs b/tests/dom_fragment_test.rs index ef483bac0..b325e8c57 100644 --- a/tests/dom_fragment_test.rs +++ b/tests/dom_fragment_test.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::*; use test_fixtures::simple_program; use wasm_bindgen_test::*; diff --git a/tests/dom_insert_before_after_patches.rs b/tests/dom_insert_before_after_patches.rs index ae4f8b8e4..09caec9de 100644 --- a/tests/dom_insert_before_after_patches.rs +++ b/tests/dom_insert_before_after_patches.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::{ html::{attributes::*, *}, *, diff --git a/tests/dom_insert_patches.rs b/tests/dom_insert_patches.rs index 5fc8a81ab..8b97cd69f 100644 --- a/tests/dom_insert_patches.rs +++ b/tests/dom_insert_patches.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::{ html::{attributes::*, *}, *, diff --git a/tests/dom_keyed_subsequent_updates.rs b/tests/dom_keyed_subsequent_updates.rs index 9c79f9be6..c145825fc 100644 --- a/tests/dom_keyed_subsequent_updates.rs +++ b/tests/dom_keyed_subsequent_updates.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::{ html::{attributes::*, *}, *, diff --git a/tests/dom_node_event_recycling.rs b/tests/dom_node_event_recycling.rs index 7b1683c40..d0dfcfb7e 100644 --- a/tests/dom_node_event_recycling.rs +++ b/tests/dom_node_event_recycling.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::{html::attributes::*, html::events::*, html::*}; use sauron::{vdom::TreePath, *}; use std::{cell::RefCell, rc::Rc}; diff --git a/tests/dom_passing_reordered_keyed_node.rs b/tests/dom_passing_reordered_keyed_node.rs index 14ee185b6..730f62261 100644 --- a/tests/dom_passing_reordered_keyed_node.rs +++ b/tests/dom_passing_reordered_keyed_node.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::*; use test_fixtures::simple_program; use wasm_bindgen_test::*; diff --git a/tests/dom_patches_keyed.rs b/tests/dom_patches_keyed.rs index 23e388673..d62c27aa8 100644 --- a/tests/dom_patches_keyed.rs +++ b/tests/dom_patches_keyed.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::{ html::{attributes::*, *}, *, diff --git a/tests/dom_patches_text_node.rs b/tests/dom_patches_text_node.rs index 7da7ff9aa..690553d33 100644 --- a/tests/dom_patches_text_node.rs +++ b/tests/dom_patches_text_node.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::{html::attributes::*, html::*, *}; use test_fixtures::simple_program; diff --git a/tests/dom_remove_node_patches.rs b/tests/dom_remove_node_patches.rs index 1a933c6de..2862a2e11 100644 --- a/tests/dom_remove_node_patches.rs +++ b/tests/dom_remove_node_patches.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::*; use test_fixtures::simple_program; diff --git a/tests/dom_reordered_keyed_nodes.rs b/tests/dom_reordered_keyed_nodes.rs index 5870c4f00..dc346ae62 100644 --- a/tests/dom_reordered_keyed_nodes.rs +++ b/tests/dom_reordered_keyed_nodes.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::*; use test_fixtures::simple_program; use wasm_bindgen_test::*; diff --git a/tests/dom_replace_node_patches.rs b/tests/dom_replace_node_patches.rs index 5cf6e637d..b56e43066 100644 --- a/tests/dom_replace_node_patches.rs +++ b/tests/dom_replace_node_patches.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::{ html::{attributes::*, *}, *, diff --git a/tests/dom_safe_html.rs b/tests/dom_safe_html.rs index 448f0ca14..8aeabdd7f 100644 --- a/tests/dom_safe_html.rs +++ b/tests/dom_safe_html.rs @@ -1,4 +1,3 @@ -#![allow(unused)] use sauron::dom::DomNode; use sauron::parse_html; use sauron::*; diff --git a/tests/dom_swap_nodes.rs b/tests/dom_swap_nodes.rs index 541242c4c..330d7608c 100644 --- a/tests/dom_swap_nodes.rs +++ b/tests/dom_swap_nodes.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::{ html::{attributes::*, *}, *, diff --git a/tests/dom_test_update.rs b/tests/dom_test_update.rs index 38caa8730..ef89ca28b 100644 --- a/tests/dom_test_update.rs +++ b/tests/dom_test_update.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::html::*; use sauron::*; diff --git a/tests/dom_updater_test.rs b/tests/dom_updater_test.rs index 0c189d83c..2e621d6ff 100644 --- a/tests/dom_updater_test.rs +++ b/tests/dom_updater_test.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::prelude::*; use std::{cell::RefCell, rc::Rc}; use test_fixtures::simple_program; diff --git a/tests/dom_updates_target_dom.rs b/tests/dom_updates_target_dom.rs index cec395df4..4ed8324e5 100644 --- a/tests/dom_updates_target_dom.rs +++ b/tests/dom_updates_target_dom.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::html::*; use sauron::*; diff --git a/tests/dom_util_functions.rs b/tests/dom_util_functions.rs index 9ae215eec..f20f40707 100644 --- a/tests/dom_util_functions.rs +++ b/tests/dom_util_functions.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] use sauron::dom::delay; use wasm_bindgen_test::*; diff --git a/tests/test_fixtures.rs b/tests/test_fixtures.rs index 89688f372..5242aa5ef 100644 --- a/tests/test_fixtures.rs +++ b/tests/test_fixtures.rs @@ -1,4 +1,3 @@ -#![deny(warnings)] //! This is useful only for testing //! This is a simple component which just barely comply to being a component //! use for doing component tests