HS: resize observer mock + on resize (+3 tests)
Cluster 26. Three parts:
(a) `tests/hs-run-filtered.js`: mock style is now a Proxy that dispatches
a synthetic `resize` DOM event on the owning element whenever
`width` / `height` changes (via `setProperty` or direct assignment).
Detail carries numeric `width` / `height` parsed from the current
inline style. Strengthens the old no-op ResizeObserver stub into an
`HsResizeObserver` class with a per-element callback registry
(collision-proof name vs. cluster 27's IntersectionObserver); HS's
`on resize` uses the plain DOM event path, not the observer API.
Adds `ResizeObserverEntry` for code that references it.
(b) `tests/playwright/generate-sx-tests.py`: new pattern for
`(page.)?evaluate(() => [{] document.{getElementById|querySelector}(…).style.PROP = 'VAL'; [}])`
emitting `(host-set! (host-get target "style") "PROP" "VAL")`.
(c) `spec/tests/test-hyperscript-behavioral.sx`: regenerated — the three
resize fixtures now carry the style mutation step between activate
and assert.
No parser/compiler/runtime changes: `on resize` already parses via
`parse-compound-event-name`, and `hs-on` binds via `dom-listen` which is
plain `addEventListener("resize", …)`.
Suite hs-upstream-resize: 0/3 → 3/3. Smoke 0-195: 164/195 → 165/195
(the +1 smoke bump is logAll-generator work uncommitted in the main tree
at verification time, unrelated to this cluster).
This commit is contained in:
@@ -10440,6 +10440,7 @@
|
||||
(dom-append (dom-body) _el-box)
|
||||
(dom-append (dom-body) _el-out)
|
||||
(hs-activate! _el-box)
|
||||
(host-set! (host-get (dom-query-by-id "box") "style") "width" "200px")
|
||||
(assert= (dom-text-content (dom-query-by-id "out")) "200")
|
||||
))
|
||||
(deftest "provides height in detail"
|
||||
@@ -10452,6 +10453,7 @@
|
||||
(dom-append (dom-body) _el-box)
|
||||
(dom-append (dom-body) _el-out)
|
||||
(hs-activate! _el-box)
|
||||
(host-set! (host-get (dom-query-by-id "box") "style") "height" "300px")
|
||||
(assert= (dom-text-content (dom-query-by-id "out")) "300")
|
||||
))
|
||||
(deftest "works with from clause"
|
||||
@@ -10464,6 +10466,7 @@
|
||||
(dom-append (dom-body) _el-box)
|
||||
(dom-append (dom-body) _el-out)
|
||||
(hs-activate! _el-out)
|
||||
(host-set! (host-get (dom-query-by-id "box") "style") "width" "150px")
|
||||
(assert= (dom-text-content (dom-query-by-id "out")) "150")
|
||||
))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user