Skip to content

Behavioral baseline test suite for props/events plugins (#113)#114

Merged
DmitrySharabin merged 10 commits into
rollback-signalsfrom
props-behavioral-tests
May 15, 2026
Merged

Behavioral baseline test suite for props/events plugins (#113)#114
DmitrySharabin merged 10 commits into
rollback-signalsfrom
props-behavioral-tests

Conversation

@DmitrySharabin
Copy link
Copy Markdown
Member

@DmitrySharabin DmitrySharabin commented May 14, 2026

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).

🤖 Generated with Claude Code

@DmitrySharabin DmitrySharabin marked this pull request as ready for review May 15, 2026 10:50
@DmitrySharabin DmitrySharabin requested a review from Copilot May 15, 2026 10:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread test/plugins/props/reflection.js
Comment thread test/plugins/props/lifecycle.js
Comment thread test/plugins/props/inheritance.js Outdated
Comment thread test/plugins/events/propchange.js
Comment thread test/plugins/props/defaults.js
Comment thread test/plugins/props/propchange.js Outdated
Comment thread test/plugins/props/computed.js Outdated
Comment thread test/plugins/props/defaults.js
@DmitrySharabin DmitrySharabin force-pushed the props-behavioral-tests branch 2 times, most recently from 8c6807e to f953de8 Compare May 15, 2026 18:07
{
name: "Queued propchange events drain on reconnect",
run () {
let { element } = this.data;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making sure that this is different per test? (I think so, but not 100% sure)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is. We create it in the beforeEach() hook.

["src", "initial"],
["mirror", "initial"],
["src", "changed"],
["mirror", "changed"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a dictionary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it should be an object literal (where emitted too). Anyway it doesn't matter much

Comment thread test/plugins/props/reflection.js Outdated
@DmitrySharabin DmitrySharabin force-pushed the props-behavioral-tests branch 2 times, most recently from d3413a0 to d0b7b51 Compare May 15, 2026 21:41
DmitrySharabin and others added 10 commits May 15, 2026 23:44
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>
@DmitrySharabin DmitrySharabin force-pushed the props-behavioral-tests branch from d0b7b51 to 4c7a82d Compare May 15, 2026 21:45
@DmitrySharabin DmitrySharabin merged commit 35a2039 into rollback-signals May 15, 2026
@DmitrySharabin DmitrySharabin deleted the props-behavioral-tests branch May 15, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants