Behavioral baseline test suite for props/events plugins (#113)#114
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a Happy DOM–based behavioral test suite for the Props and Events plugins to serve as a regression baseline for #113 and to codify expected behavior around reflection, defaults, computed props, propchange semantics, lifecycle reconnect behavior, inheritance, and shortcut-event catch-up dispatch.
Changes:
- Reworks/expands Props plugin behavioral tests under
test/plugins/props/(reflection, defaults, computed, propchange, lifecycle, inheritance, install). - Adds Events plugin behavioral coverage under
test/plugins/events/(propchange shortcut catch-up detail). - Updates the plugin test index to include the new suites.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/plugins/props/reflection.js | Expands reflection/attribute semantics coverage, including #98 baseline. |
| test/plugins/props/defaults.js | Adds defaults behavior coverage (literal/function/defaultProp/undefined/null). |
| test/plugins/props/computed.js | Adds computed get() behavior and equals tolerance coverage. |
| test/plugins/props/propchange.js | Adds behavioral assertions for propchange event streams and ordering. |
| test/plugins/props/lifecycle.js | Adds disconnect/reconnect queue-drain baseline (#100). |
| test/plugins/props/inheritance.js | Adds baseline for inherited static props support (#104). |
| test/plugins/props/install.js | Adds baseline for pre-connect property/attribute writes surviving mount. |
| test/plugins/props/index.js | Regroups props tests into a shared “Behavior” harness + adds new suites. |
| test/plugins/events/propchange.js | Adds baseline for shortcut-event catch-up carrying detail (#106). |
| test/plugins/events/index.js | Adds Events plugin test suite entry point. |
| test/plugins/index.js | Includes the new Events plugin suite in the overall plugin tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8c6807e to
f953de8
Compare
| { | ||
| name: "Queued propchange events drain on reconnect", | ||
| run () { | ||
| let { element } = this.data; |
There was a problem hiding this comment.
Just making sure that this is different per test? (I think so, but not 100% sure)
There was a problem hiding this comment.
It is. We create it in the beforeEach() hook.
| ["src", "initial"], | ||
| ["mirror", "initial"], | ||
| ["src", "changed"], | ||
| ["mirror", "changed"], |
There was a problem hiding this comment.
Shouldn't this be a dictionary?
There was a problem hiding this comment.
What do you mean?
There was a problem hiding this comment.
This feels like it should be an object literal (where emitted too). Anyway it doesn't matter much
d3413a0 to
d0b7b51
Compare
Adopt main's runtime behavior tests into the happy-dom suite, regrouped under test/plugins/props/ by concern: reflection, defaults, computed. The shared beforeEach now supports pre-connect `attributes` setup. Several tests fail intentionally, exposing pre-existing bugs — kept visible as the issue #113 regression net rather than skipped: - #98: post-mount setAttribute does not update the property - cleared reflected props leave a stale attribute - null collapses to the default on a prop that has one Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Continue adopting main's behavioral tests into the happy-dom suite, under test/plugins/props/: - propchange.js: 6 tests asserting which props fire, how often, and in what order (name-only — decoupled from the `source` implementation detail). - lifecycle.js: a two-phase disconnect/reconnect test for queued-event draining. - The shared beforeEach records propchange'd prop names for these groups. - reflection.js and defaults.js each gain one more behavioral test. Failing tests stay visible as the issue #113 regression net. Newly surfaced: propchange fires dependents before dependencies, synthetic default-prop events leak to consumers, and queued events don't drain on reconnect (#100). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Completes the issue #113 bug coverage: - test/plugins/props/inheritance.js: a two-level class hierarchy where both classes declare static props (#104). Passes on e344b1f — the bug was introduced later — so it serves as a regression guard. - test/plugins/events/: first events-plugin test. A markup-declared on*= handler only sees the first_connected catch-up re-fire, which must carry a detail (#106). Fails — the bug is present on e344b1f. All four #113 "bugs to fix" (#98, #100, #104, #106) now have tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add 8 new tests (sync IDL set/get, three sync writes with value payload,
write equal to default still reflects, removeAttribute collapses to
default, asymmetric reflect { from, to }, plain literal default on read,
post-convert no-op propchange, pre-connect install)
- Move "explicit write equal to default" and "removeAttribute collapses"
from defaults.js to reflection.js (their structural home)
- Restructure props plugin into Behavior / Inheritance / Installation
subgroups so the latter two don't have to shadow shared lifecycle hooks
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Shared propchange listener now records [name, value-at-event-time] tuples; propchange.js expects updated accordingly so a regression that fires the right events with wrong payloads is now caught. - defaults.js and computed.js shared `run` returns the value chain (initial + after each action) when actions are present, so tests assert the full evolution rather than only the final value. - lifecycle.js captures values too; snapshots clone tuples to avoid a misleading [Circular] diff when before/after share references. - Exposed a latent under-specification in the convert-no-op test (htest deep-equals allows actual longer than expect, so the old `["v"]` silently passed an extra event). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two tests asserted that synthetic default props (created internally for function defaults with deps) don't fire propchange. They actually do, by design — analogous to .value/.defaultValue on native form controls, per #113. Updated expectations and the misleading test name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
531e3c2 to
eeee531
Compare
d0b7b51 to
4c7a82d
Compare
Summary
A happy-dom-based behavioral test suite for the props and events plugins, serving as the issue #113 regression net (rolling back and reimplementing signals).
test/plugins/props/andtest/plugins/events/; skips ones that test signals internals.setAttribute()after mount does not update the property on plainreflectprops #98,propchangeevents queued while disconnected are not dispatched on reconnect #100, [Props] static props not inherited from parent class #104, Populate detail on first_connected shortcut re-fires #106).🤖 Generated with Claude Code