Fix tests in counter example

This commit is contained in:
Greg Johnston 2022-12-19 16:14:46 -05:00
parent c63c8728a7
commit d6920847ca

View file

@ -10,11 +10,16 @@ fn inc() {
let document = leptos::document();
let div = document.query_selector("div").unwrap().unwrap();
let dec = div
let clear = div
.first_child()
.unwrap()
.dyn_into::<HtmlElement>()
.unwrap();
let dec = clear
.next_sibling()
.unwrap()
.dyn_into::<HtmlElement>()
.unwrap();
let text = dec
.next_sibling()
.unwrap()
@ -29,12 +34,16 @@ fn inc() {
inc.click();
inc.click();
assert_eq!(text.text_content(), Some("2".to_string()));
assert_eq!(text.text_content(), Some("Value: 2!".to_string()));
dec.click();
dec.click();
dec.click();
dec.click();
assert_eq!(text.text_content(), Some("-2".to_string()));
assert_eq!(text.text_content(), Some("Value: -2!".to_string()));
clear.click();
assert_eq!(text.text_content(), Some("Value: 0!".to_string()));
}