♻️ Atributos class e id explícitos en html!
Se usa `class="..."` e `id="..."` en lugar de `div.a #x`. El HTML generado es idéntico.
This commit is contained in:
parent
58d1fef4f1
commit
3f3634fdab
21 changed files with 80 additions and 74 deletions
|
|
@ -15,7 +15,7 @@ fn header<'a>(response: &'a web::Response, name: &str) -> Option<&'a str> {
|
|||
|
||||
#[pagetop::test]
|
||||
async fn new_renders_the_given_markup_with_an_html_content_type() {
|
||||
let response = HtmxResponse::new(html! { li #item-42 { "New item" } }).into_response();
|
||||
let response = HtmxResponse::new(html! { li id="item-42" { "New item" } }).into_response();
|
||||
|
||||
assert_eq!(
|
||||
header(&response, "content-type"),
|
||||
|
|
@ -41,8 +41,8 @@ async fn empty_has_no_body_but_keeps_the_html_content_type() {
|
|||
|
||||
#[pagetop::test]
|
||||
async fn oob_appends_markup_after_the_main_body() {
|
||||
let response = HtmxResponse::new(html! { li #item-42 { "New item" } })
|
||||
.oob(html! { span #item-count hx-swap-oob="true" { "1" } })
|
||||
let response = HtmxResponse::new(html! { li id="item-42" { "New item" } })
|
||||
.oob(html! { span id="item-count" hx-swap-oob="true" { "1" } })
|
||||
.into_response();
|
||||
|
||||
let body = web::test::read_body_text(response).await;
|
||||
|
|
@ -58,8 +58,8 @@ async fn oob_appends_markup_after_the_main_body() {
|
|||
#[pagetop::test]
|
||||
async fn oob_can_be_called_several_times_to_accumulate_fragments() {
|
||||
let response = HtmxResponse::new(html! { p { "Main" } })
|
||||
.oob(html! { span #a hx-swap-oob="true" { "A" } })
|
||||
.oob(html! { span #b hx-swap-oob="true" { "B" } })
|
||||
.oob(html! { span id="a" hx-swap-oob="true" { "A" } })
|
||||
.oob(html! { span id="b" hx-swap-oob="true" { "B" } })
|
||||
.into_response();
|
||||
|
||||
let body = web::test::read_body_text(response).await;
|
||||
|
|
@ -76,7 +76,7 @@ async fn oob_can_be_called_several_times_to_accumulate_fragments() {
|
|||
#[pagetop::test]
|
||||
async fn oob_works_from_an_empty_response() {
|
||||
let response = HtmxResponse::empty()
|
||||
.oob(html! { span #item-count hx-swap-oob="true" { "0" } })
|
||||
.oob(html! { span id="item-count" hx-swap-oob="true" { "0" } })
|
||||
.into_response();
|
||||
|
||||
let body = web::test::read_body_text(response).await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue