test: complete AC17 fields-present assertions

This commit is contained in:
2026-05-27 23:39:35 -07:00
parent 1be83a01f5
commit c6699dd05a

View File

@@ -697,7 +697,11 @@
;;; --------------------------------------------------------------------------- ;;; ---------------------------------------------------------------------------
(deftest fields-present-in-both-modes-test (deftest fields-present-in-both-modes-test
(testing "AC17: vendor field is present in simple mode" ;; NOTE: memo and approval-status fields are rendered by LinksStep/render-step
;; (outside of #manual-coding-section), so they cannot be tested at the
;; manual-coding-section* level. This test covers what manual-coding-section*
;; is directly responsible for.
(testing "AC17: key fields are present in both simple and advanced modes"
(let [result @(dc/transact conn [{:db/id "client-id" (let [result @(dc/transact conn [{:db/id "client-id"
:client/code "FLDTESTCL" :client/code "FLDTESTCL"
:client/locations ["DT"]} :client/locations ["DT"]}
@@ -735,6 +739,7 @@
(fc/start-form (:multi-form-state (make-req :advanced one-account)) nil (fc/start-form (:multi-form-state (make-req :advanced one-account)) nil
(fc/with-field :step-params (fc/with-field :step-params
(manual-coding-section* :advanced (make-req :advanced one-account)))))] (manual-coding-section* :advanced (make-req :advanced one-account)))))]
;; --- Vendor field assertions (both modes) ---
(is (re-find #"Vendor" html-simple) (is (re-find #"Vendor" html-simple)
"AC17: Vendor field label must appear in simple mode") "AC17: Vendor field label must appear in simple mode")
(is (re-find #"vendor/search" html-simple) (is (re-find #"vendor/search" html-simple)
@@ -746,7 +751,24 @@
(is (re-find #"vendor/search" html-advanced) (is (re-find #"vendor/search" html-advanced)
"AC17: Vendor typeahead/search URL must appear in advanced mode") "AC17: Vendor typeahead/search URL must appear in advanced mode")
(is (re-find #"transaction/vendor" html-advanced) (is (re-find #"transaction/vendor" html-advanced)
"AC17: Vendor field name must appear in advanced mode")))) "AC17: Vendor field name must appear in advanced mode")
;; --- Hidden mode input (proves section is complete) ---
(is (re-find #"name=\"mode\".*value=\"simple\"" html-simple)
"AC17: hidden mode=simple input must be present in simple mode")
(is (re-find #"name=\"mode\".*value=\"advanced\"" html-advanced)
"AC17: hidden mode=advanced input must be present in advanced mode")
;; --- Simple-mode-specific fields: account typeahead, location select, toggle link ---
(is (re-find #"account/search" html-simple)
"AC17: account typeahead search URL must appear in simple mode")
(is (re-find #"transaction-account/location" html-simple)
"AC17: location select field name must appear in simple mode")
(is (re-find #"Switch to advanced mode" html-simple)
"AC17: toggle link to advanced mode must appear in simple mode")
;; --- Advanced-mode-specific: account-grid-body and toggle link ---
(is (re-find #"account-grid-body" html-advanced)
"AC17: #account-grid-body must be present in advanced mode")
(is (re-find #"Switch to simple mode" html-advanced)
"AC17: toggle link to simple mode must appear in advanced mode (<=1 row)"))))
;;; --------------------------------------------------------------------------- ;;; ---------------------------------------------------------------------------
;;; AC18: switching modes mid-edit then saving produces a valid transaction ;;; AC18: switching modes mid-edit then saving produces a valid transaction