fix(runtime): make form defaults post declaratively
req: form/002 req: examples/005 req: convention/004
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
<section class="workspace">
|
<section class="workspace">
|
||||||
<aside class="command-card">
|
<aside class="command-card">
|
||||||
<h2>Create an issue</h2>
|
<h2>Create an issue</h2>
|
||||||
<form id="launch-work" data-slhx-handle="launch_work" data-slhx-form="launch_work" data-slhx-disable-while-pending>
|
<form id="launch-work" method="post" data-slhx-handle="launch_work" data-slhx-form="launch_work" data-slhx-disable-while-pending>
|
||||||
<input type="hidden" name="__h" value="539242093">
|
<input type="hidden" name="__h" value="539242093">
|
||||||
<label>Title <input name="title" required="required" value="Ship typed effects"></label>
|
<label>Title <input name="title" required="required" value="Ship typed effects"></label>
|
||||||
<label>Lane
|
<label>Lane
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label>Impact <input name="impact" type="number" min="1" max="9" value="7"></label>
|
<label>Impact <input name="impact" type="number" min="1" max="9" value="7"></label>
|
||||||
<button class="primary-action" type="button" data-slhx-handle="launch_work">Create issue</button>
|
<button class="primary-action" type="button" form="launch-work" data-slhx-handle="launch_work" data-slhx-on="click">Create issue</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="quick-actions">
|
<div class="quick-actions">
|
||||||
<button type="button" data-slhx-handle="simulate_push">Simulate server push</button>
|
<button type="button" data-slhx-handle="simulate_push">Simulate server push</button>
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ async fn browser_drives_typed_product_end_to_end() -> WebDriverResult<()> {
|
|||||||
.await?;
|
.await?;
|
||||||
wait_for_text(&driver, &slot_selector(ui::control_center::slots::notice.id().id), "Push simulated").await?;
|
wait_for_text(&driver, &slot_selector(ui::control_center::slots::notice.id().id), "Push simulated").await?;
|
||||||
|
|
||||||
|
driver.find(By::Css("button.primary-action")).await?.click().await?;
|
||||||
|
wait_for_text(&driver, ".work-card[data-key='4']", "Ship typed effects").await?;
|
||||||
|
assert_text(&driver, "width:77%").await?;
|
||||||
|
|
||||||
drag_card_to_lane(&driver, 2, "product").await?;
|
drag_card_to_lane(&driver, 2, "product").await?;
|
||||||
wait_for_text(&driver, ".lane[data-lane='product'] .work-card[data-key='2']", "Shipped").await?;
|
wait_for_text(&driver, ".lane[data-lane='product'] .work-card[data-key='2']", "Shipped").await?;
|
||||||
wait_for_text(&driver, &slot_selector(ui::control_center::slots::notice.id().id), "Drag-and-drop move persisted").await?;
|
wait_for_text(&driver, &slot_selector(ui::control_center::slots::notice.id().id), "Drag-and-drop move persisted").await?;
|
||||||
|
|||||||
@@ -123,7 +123,7 @@
|
|||||||
const abort = new AbortController();
|
const abort = new AbortController();
|
||||||
let finish;
|
let finish;
|
||||||
const done = new Promise((resolve) => { finish = resolve; });
|
const done = new Promise((resolve) => { finish = resolve; });
|
||||||
const method = String((form && form.method) || "POST").toUpperCase();
|
const method = String((form && form.getAttribute("method")) || "POST").toUpperCase();
|
||||||
const body = method === "GET" || method === "HEAD" ? undefined : requestBody(data, multipart);
|
const body = method === "GET" || method === "HEAD" ? undefined : requestBody(data, multipart);
|
||||||
const headers = { "X-SLHX-Partial": "1", "Accept": "application/slhx, text/html" };
|
const headers = { "X-SLHX-Partial": "1", "Accept": "application/slhx, text/html" };
|
||||||
if (body instanceof URLSearchParams) headers["Content-Type"] = "application/x-www-form-urlencoded;charset=UTF-8";
|
if (body instanceof URLSearchParams) headers["Content-Type"] = "application/x-www-form-urlencoded;charset=UTF-8";
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ fn runtime_posts_urlencoded_forms_by_default() {
|
|||||||
let source = slhx_js::RUNTIME_JS;
|
let source = slhx_js::RUNTIME_JS;
|
||||||
|
|
||||||
assert!(source.contains("new URLSearchParams()"));
|
assert!(source.contains("new URLSearchParams()"));
|
||||||
|
assert!(source.contains("form.getAttribute(\"method\")"));
|
||||||
assert!(source.contains("multipart/form-data"));
|
assert!(source.contains("multipart/form-data"));
|
||||||
assert!(source.contains("const body = method === \"GET\" || method === \"HEAD\" ? undefined : requestBody(data, multipart)"));
|
assert!(source.contains("const body = method === \"GET\" || method === \"HEAD\" ? undefined : requestBody(data, multipart)"));
|
||||||
assert!(source.contains("application/x-www-form-urlencoded;charset=UTF-8"));
|
assert!(source.contains("application/x-www-form-urlencoded;charset=UTF-8"));
|
||||||
|
|||||||
Reference in New Issue
Block a user