mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
examples: update directives tests
This commit is contained in:
parent
081f4ec550
commit
fc59cdaf61
3 changed files with 7 additions and 12 deletions
|
@ -13,5 +13,4 @@ web-sys = { version = "0.3", features = ["Clipboard", "Navigator"] }
|
|||
[dev-dependencies]
|
||||
wasm-bindgen-test = "0.3.0"
|
||||
wasm-bindgen = "0.2"
|
||||
web-sys = "0.3"
|
||||
gloo-timers = { version = "0.3", features = ["futures"] }
|
||||
web-sys = { version = "0.3", features = ["NodeList"] }
|
||||
|
|
|
@ -85,7 +85,6 @@ pub fn App() -> impl IntoView {
|
|||
<a href="#" use:copy_to_clipboard=data>"Copy \"" {data} "\" to clipboard"</a>
|
||||
// automatically applies the directive to every root element in `SomeComponent`
|
||||
<SomeComponent use:highlight />
|
||||
<p use:highlight>"click me"</p>
|
||||
// no value will default to `().into()`
|
||||
<button use:add_dot>"Add a dot"</button>
|
||||
// `5.into()` automatically called
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
use gloo_timers::future::sleep;
|
||||
use std::time::Duration;
|
||||
use directives::App;
|
||||
use leptos::{prelude::*, spawn::tick};
|
||||
use wasm_bindgen::JsCast;
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
wasm_bindgen_test_configure!(run_in_browser);
|
||||
use directives::App;
|
||||
use leptos::prelude::*;
|
||||
use web_sys::HtmlElement;
|
||||
|
||||
wasm_bindgen_test_configure!(run_in_browser);
|
||||
#[wasm_bindgen_test]
|
||||
async fn test_directives() {
|
||||
mount_to_body(|| view! { <App/> });
|
||||
sleep(Duration::ZERO).await;
|
||||
leptos::mount::mount_to_body(App);
|
||||
tick().await;
|
||||
|
||||
let document = leptos::document();
|
||||
let document = document();
|
||||
let paragraphs = document.query_selector_all("p").unwrap();
|
||||
|
||||
assert_eq!(paragraphs.length(), 3);
|
||||
|
|
Loading…
Reference in a new issue