Skip to content

Commit

Permalink
fix all the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj committed Sep 29, 2023
1 parent c93f1a3 commit 22a08ad
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion leptos_reactive/src/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,29 +241,39 @@ impl<In, Out> Fn<(In,)> for SyncCallback<In, Out> {

#[cfg(test)]
mod tests {
use crate::callback::{Callback, SyncCallback};
use crate::{
callback::{Callback, SyncCallback},
create_runtime,
};

struct NoClone {}

#[test]
fn clone_callback() {
let rt = create_runtime();
let callback = Callback::new(move |_no_clone: NoClone| NoClone {});
let _cloned = callback.clone();
rt.dispose();
}

#[test]
fn clone_sync_callback() {
let rt = create_runtime();
let callback = SyncCallback::new(move |_no_clone: NoClone| NoClone {});
let _cloned = callback.clone();
rt.dispose();
}

#[test]
fn callback_from() {
let rt = create_runtime();
let _callback: Callback<(), String> = (|()| "test").into();
rt.dispose();
}

#[test]
fn callback_from_html() {
let rt = create_runtime();
use leptos::{
html::{AnyElement, HtmlElement},
*,
Expand All @@ -276,11 +286,14 @@ mod tests {
}
})
.into();
rt.dispose();
}

#[test]
fn sync_callback_from() {
let rt = create_runtime();
let _callback: SyncCallback<(), String> = (|()| "test").into();
rt.dispose();
}

#[test]
Expand All @@ -290,12 +303,16 @@ mod tests {
*,
};

let rt = create_runtime();

let _callback: SyncCallback<String, HtmlElement<AnyElement>> =
(|x: String| {
view! {
<h1>{x}</h1>
}
})
.into();

rt.dispose();
}
}

0 comments on commit 22a08ad

Please sign in to comment.