Skip to content

Commit 4723fff

Browse files
committed
add
1 parent 67bfd5f commit 4723fff

File tree

1 file changed

+20
-0
lines changed
  • packages/yew/src/html/listener

1 file changed

+20
-0
lines changed

packages/yew/src/html/listener/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,23 @@ where
128128
Some(Callback::from(self?))
129129
}
130130
}
131+
132+
#[cfg(test)]
133+
mod tests {
134+
use super::*;
135+
136+
#[test]
137+
fn supported_into_event_callback_types() {
138+
let f = |_: usize| ();
139+
let cb = Callback::from(f);
140+
141+
// Callbacks
142+
let _: Option<Callback<usize>> = cb.clone().into_event_callback();
143+
let _: Option<Callback<usize>> = (&cb).into_event_callback();
144+
let _: Option<Callback<usize>> = Some(cb).into_event_callback();
145+
146+
// Fns
147+
let _: Option<Callback<usize>> = f.into_event_callback();
148+
let _: Option<Callback<usize>> = Some(f).into_event_callback();
149+
}
150+
}

0 commit comments

Comments
 (0)