mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
fix: () in templates
This commit is contained in:
parent
a42e371e79
commit
722fd0f6c2
2 changed files with 12 additions and 6 deletions
|
@ -1,18 +1,18 @@
|
|||
use js_framework_benchmark_leptos::*;
|
||||
use leptos::prelude::*;
|
||||
use leptos::{prelude::*, spawn::tick};
|
||||
use wasm_bindgen::JsCast;
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
wasm_bindgen_test_configure!(run_in_browser);
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn add_item() {
|
||||
let document = leptos::document();
|
||||
async fn add_item() {
|
||||
let document = document();
|
||||
let test_wrapper = document.create_element("section").unwrap();
|
||||
let _ = document.body().unwrap().append_child(&test_wrapper);
|
||||
|
||||
// start by rendering our counter and mounting it to the DOM
|
||||
mount_to(test_wrapper.clone().unchecked_into(), || view! { <App/> });
|
||||
let _handle = mount_to(test_wrapper.clone().unchecked_into(), App);
|
||||
|
||||
let table = test_wrapper
|
||||
.query_selector("table")
|
||||
|
@ -37,21 +37,26 @@ fn add_item() {
|
|||
.unwrap()
|
||||
.unwrap()
|
||||
.unchecked_into::<web_sys::HtmlButtonElement>();
|
||||
_handle.forget();
|
||||
|
||||
// now let's click the `clear` button
|
||||
clear.click();
|
||||
tick().await;
|
||||
|
||||
// now check that table is empty
|
||||
assert_eq!(table.rows().length(), 0);
|
||||
|
||||
create.click();
|
||||
tick().await;
|
||||
|
||||
assert_eq!(table.rows().length(), 10000);
|
||||
add.click();
|
||||
tick().await;
|
||||
|
||||
assert_eq!(table.rows().length(), 11000);
|
||||
|
||||
clear.click();
|
||||
tick().await;
|
||||
|
||||
assert_eq!(table.rows().length(), 0)
|
||||
}
|
||||
|
|
|
@ -80,15 +80,16 @@ impl<R: Renderer> Mountable<R> for () {
|
|||
}
|
||||
|
||||
impl ToTemplate for () {
|
||||
const TEMPLATE: &'static str = "";
|
||||
const TEMPLATE: &'static str = "<!>";
|
||||
|
||||
fn to_template(
|
||||
_buf: &mut String,
|
||||
buf: &mut String,
|
||||
_class: &mut String,
|
||||
_style: &mut String,
|
||||
_inner_html: &mut String,
|
||||
_position: &mut Position,
|
||||
) {
|
||||
buf.push_str("<!>");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue