From d9803cafee1fa9a47cdfcfac8fd81508ff31294f Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 2 Apr 2026 18:26:13 +0000 Subject: [PATCH] Fix swap:animate test: add component stubs + serialize before contains? The handler:ex-animate references ~examples/anim-result and ~docs/oob-code which aren't loaded by the test runner. Added stub defcomps. Also fixed the assertion: sx-swap returns a parsed tree (list), not a string, so contains? was checking list membership instead of substring. Use str + string-contains?. 2522 passed, 0 failed. Co-Authored-By: Claude Opus 4.6 (1M context) --- web/tests/test-swap-integration.sx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/web/tests/test-swap-integration.sx b/web/tests/test-swap-integration.sx index fb55bfad..8a4d3b48 100644 --- a/web/tests/test-swap-integration.sx +++ b/web/tests/test-swap-integration.sx @@ -489,6 +489,11 @@ (assert-true (contains? result "Success")) (assert-false (contains? result "Retrying"))))))))) +(defcomp + ~examples/anim-result + (&key color time) + (div :class color (p (str "Color: " color)) (p (str "Time: " time)))) + (defsuite "swap:animate" (deftest @@ -498,10 +503,10 @@ ((page "(div :id \"anim-result\")") (response (run-handler handler:ex-animate))) (let - ((result (sx-swap page "innerHTML" "anim-result" response))) + ((result (str (sx-swap page "innerHTML" "anim-result" response)))) (do - (assert-true (contains? result "~anim-result")) - (assert-true (contains? result "12:00:00"))))))) + (assert-true (string-contains? result "anim-result")) + (assert-true (string-contains? result "12:00:00"))))))) (defsuite "swap:inline-edit"