Skip to content

Commit 601c8fe

Browse files
feat: add events (#36)
1 parent e96875f commit 601c8fe

File tree

8 files changed

+450
-1
lines changed

8 files changed

+450
-1
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/dom/Cargo.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,63 @@ regex.workspace = true
1919
thiserror.workspace = true
2020
wasm-bindgen.workspace = true
2121
web-sys = { workspace = true, features = [
22+
"AnimationEvent",
23+
"AnimationEventInit",
2224
"Attr",
25+
"ClipboardEvent",
26+
"ClipboardEventInit",
2327
"Comment",
28+
"CompositionEvent",
29+
"CompositionEventInit",
2430
"Document",
2531
"DocumentFragment",
32+
"DragEvent",
33+
"DragEventInit",
2634
"Element",
35+
"Event",
36+
"EventInit",
37+
"EventTarget",
38+
"FocusEvent",
39+
"FocusEventInit",
2740
"HtmlCollection",
2841
"HtmlElement",
2942
"HtmlInputElement",
3043
"HtmlLabelElement",
3144
"HtmlOptionElement",
3245
"HtmlOptionsCollection",
3346
"HtmlSelectElement",
47+
"InputEvent",
48+
"InputEventInit",
49+
"KeyboardEvent",
50+
"KeyboardEventInit",
51+
"MouseEvent",
52+
"MouseEventInit",
3453
"NamedNodeMap",
3554
"NodeList",
55+
"PageTransitionEvent",
56+
"PageTransitionEventInit",
57+
"PointerEvent",
58+
"PointerEventInit",
59+
"PopStateEvent",
60+
"PopStateEventInit",
61+
"ProgressEvent",
62+
"ProgressEventInit",
3663
"Text",
64+
"TouchEvent",
65+
"TouchEventInit",
66+
"TransitionEvent",
67+
"TransitionEventInit",
68+
"UiEvent",
69+
"UiEventInit",
70+
"WheelEvent",
71+
"WheelEventInit",
3772
"Window",
3873
] }
3974

4075
[dev-dependencies]
4176
indoc = "2.0.5"
4277
mockall = "0.13.0"
78+
send_wrapper = "0.6.0"
4379
wasm-bindgen-test.workspace = true
4480

4581
[lints.rust]

packages/dom/src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::{
99
static CONFIG: LazyLock<Arc<Mutex<Config>>> = LazyLock::new(|| {
1010
Arc::new(Mutex::new(Config {
1111
test_id_attribute: "data-testid".into(),
12+
event_wrapper: Arc::new(|cb| cb()),
1213
default_hidden: false,
1314
default_ignore: "script, style".into(),
1415
show_original_stack_trace: false,

packages/dom/src/error.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,23 @@ pub enum QueryError {
1212
#[error("{0}")]
1313
Unsupported(String),
1414
}
15+
16+
#[derive(Debug, Error, PartialEq)]
17+
pub enum FireEventError {
18+
#[error("{0:?}")]
19+
JsError(JsValue),
20+
}
21+
22+
#[derive(Debug, Error, PartialEq)]
23+
pub enum CreateEventError {
24+
#[error("{0:?}")]
25+
JsError(JsValue),
26+
}
27+
28+
#[derive(Debug, Error, PartialEq)]
29+
pub enum CreateOrFireEventError {
30+
#[error(transparent)]
31+
Create(#[from] CreateEventError),
32+
#[error(transparent)]
33+
Fire(#[from] FireEventError),
34+
}

0 commit comments

Comments
 (0)