Skip to content

Commit

Permalink
fixed portal test
Browse files Browse the repository at this point in the history
  • Loading branch information
maccesch committed Oct 1, 2023
1 parent 686828a commit 79ee9d7
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions examples/portal/tests/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
use leptos::*;
use portal::App;
use web_sys::HtmlElement;
use web_sys::HtmlButtonElement;

#[wasm_bindgen_test]
fn inc() {
mount_to_body(|| view! { <App/> });

let document = leptos::document();
let div = document.query_selector("div").unwrap().unwrap();
let show_button = document.get_element_by_id("btn-show").unwrap();
let show_button = document
.get_element_by_id("btn-show")
.unwrap()
.unchecked_into::<HtmlButtonElement>();

show_button.click();

Expand All @@ -38,7 +41,11 @@ fn inc() {
--><!-- </EachItem> --><!-- </Each> --></ul>"
);

let toggle_button = document.get_element_by_id("btn-toggle").unwrap();
let toggle_button = document
.get_element_by_id("btn-toggle")
.unwrap()
.unchecked_into::<HtmlButtonElement>();

toggle_button.click();

assert_eq!(
Expand All @@ -62,7 +69,11 @@ fn inc() {
--><!-- </EachItem> --><!-- </Each> --></ul>"
);

let hide_button = document.get_element_by_id("btn-hide").unwrap();
let hide_button = document
.get_element_by_id("btn-hide")
.unwrap()
.unchecked_into::<HtmlButtonElement>();

hide_button.click();

assert_eq!(
Expand Down

0 comments on commit 79ee9d7

Please sign in to comment.