refactor(ssr): revert hiccup→Selmer migration; render forms in Hiccup again
Abandons the Selmer-templating step of the SSR re-authoring and moves the four migrated form/wizard modals back to Hiccup (com/* components), keeping the whole-form HTMX swap doctrine, top-rooted render functions, and the session-backed wizard engine unchanged. - transaction/edit, transaction/bulk_code, invoices (bulk-edit group), and pos/sales_summaries render via com/* again; every hx-* swap (whole-form + targeted location-cell / totals-tbody / inline account-cell swaps) is preserved exactly. - add com/single-modal-card to centralize the md:w-[950px] md:h-[650px] modal chrome that previously lived only in the Selmer modal-card templates. - delete auto-ap.ssr.selmer, auto-ap.ssr.components.selmer, selmer_test, the whole resources/templates tree (55 files), the selmer dependency, and the tailwind resources/templates content glob. - strip Selmer guidance from the ssr-form-migration skill + modernization plan. Verified: all four namespaces compile and render with no stringified-hiccup leaks; output.css rebuilds byte-identically (no Tailwind class loss); 60 e2e specs pass — the four reverted modals (incl. whole-form-swap focus/caret tests) plus the untouched wizard/pay/new/rule modals. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
(ns auto-ap.ssr.selmer-test
|
||||
(:require
|
||||
[auto-ap.ssr.selmer :as sut]
|
||||
[clojure.string :as str]
|
||||
[clojure.test :refer [deftest is testing]]
|
||||
[hiccup2.core :as h2]))
|
||||
|
||||
(deftest hiccup->html
|
||||
(testing "renders a Hiccup form to an HTML string"
|
||||
(is (= "<span class=\"label\">A & B</span>"
|
||||
(sut/hiccup->html [:span.label "A & B"])))))
|
||||
|
||||
(deftest selmer-embeds-hiccup
|
||||
(testing "a Hiccup component renders inside a Selmer template via |safe"
|
||||
(let [frag (sut/hiccup->html [:span.badge "from hiccup"])
|
||||
out (sut/render-str "<div>{{frag|safe}}</div>" {:frag frag})]
|
||||
(is (str/includes? out "<span class=\"badge\">from hiccup</span>"))
|
||||
;; without |safe the markup would be escaped; |safe keeps it verbatim
|
||||
(is (not (str/includes? out "<span"))))))
|
||||
|
||||
(deftest selmer-fragment-inside-hiccup
|
||||
(testing "a Selmer fragment renders inside a Hiccup tree without double-escaping"
|
||||
(let [sel (sut/render-str "<a href=\"{{url}}\">{{label}}</a>" {:url "/x" :label "Go"})
|
||||
out (str (h2/html {} [:div (sut/raw sel)]))]
|
||||
(is (= "<div><a href=\"/x\">Go</a></div>" out)))))
|
||||
|
||||
(deftest render-file-from-classpath
|
||||
(testing "render-file resolves a template under resources/templates and keeps plain-HTML Alpine/HTMX attrs"
|
||||
(let [out (sut/render "templates/interop-smoke.html"
|
||||
{:title "Interop OK"
|
||||
:hiccup_frag (sut/hiccup->html [:span.badge "from hiccup"])})]
|
||||
(is (str/includes? out "Interop OK"))
|
||||
(is (str/includes? out "from hiccup"))
|
||||
;; plain-HTML attributes (the whole point of Selmer) survive unambiguously
|
||||
(is (str/includes? out "x-model=\"value.value\""))
|
||||
(is (str/includes? out "tippy?.show()")))))
|
||||
Reference in New Issue
Block a user