Address review feedback for test setup, test type coverage, and component state keys#65
Address review feedback for test setup, test type coverage, and component state keys#65JosunLP merged 5 commits intodevelopmentfrom
Conversation
Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com>
Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the v1.6.0 branch to improve test environment correctness, expand TypeScript type-check coverage across the full test suite, and align component/store typings with runtime behavior.
Changes:
- Expanded
tsconfig.component-test.jsonto type-check all files undertests/. - Fixed
getComputedStyletest shim to use a properly bound window method receiver. - Tightened typings across component state keys and store action generics; updated tests to satisfy the broader type-check surface.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.component-test.json | Expands TS include set to cover the full tests/ tree. |
| tests/view.test.ts | Adds explicit signal object typing to satisfy stricter test type-checking. |
| tests/utils.test.ts | Switches to hasOwnProperty.call checks to avoid typing/runtime issues with Object.hasOwn. |
| tests/store.test.ts | Adds explicit store generics so actions remain callable under stricter typing. |
| tests/signal.test.ts | Adds a helper to model Bun’s fetch.preconnect typing in mocks; adjusts related assertions/types. |
| tests/setup.ts | Binds window.getComputedStyle before assigning it to globalThis. |
| tests/security.test.ts | Casts sanitized result to string for assertion compatibility. |
| tests/router.test.ts | Tightens route typing and removes unused guard tracking. |
| tests/motion.test.ts | Introduces a ViewTransition mock helper and aligns startViewTransition typing with DOM lib types. |
| tests/core.test.ts | Tightens null assertions and event delegation expectations under stricter typings. |
| tests/component.test.ts | Adds a type-level assertion that numeric state keys are rejected. |
| src/store/watch.ts | Loosens action function constraints to any[]/any to allow specific parameter types. |
| src/store/types.ts | Refactors Actions typing to rely on ThisType for correct this in action bodies. |
| src/store/persisted.ts | Loosens action function constraints to support specific parameter types. |
| src/store/mapping.ts | Loosens action function constraints to support specific parameter types. |
| src/store/define-store.ts | Loosens action function constraints to support specific parameter types. |
| src/component/types.ts | Constrains component state keys to string and introduces a ComponentStateKey alias. |
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com>
Applied the export fix in commit 7f1b084. |
There was a problem hiding this comment.
Pull request overview
Updates the v1.6.0 branch to ensure the test:types step type-checks the entire tests/ suite, fixes a subtle test environment shim issue, and aligns public component/store typings with runtime behavior and TS/Bun constraints.
Changes:
- Expand
tsconfig.component-test.jsonto include all tests and adjust test files to type-check under the widened coverage. - Fix the test
getComputedStyleglobal shim by binding the window receiver correctly. - Refine public typings: constrain component state keys to string keys and loosen store action generic constraints to support specific parameter types.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.component-test.json | Includes the full tests/ tree in the type-check config. |
| tests/setup.ts | Binds window.getComputedStyle to preserve correct receiver semantics. |
| tests/view.test.ts | Tightens the signal object typing to support style property removal scenarios. |
| tests/utils.test.ts | Uses a more broadly-compatible own-property check for security regression tests. |
| tests/store.test.ts | Makes store generics explicit to keep action callability under full-suite type-checking. |
| tests/signal.test.ts | Adds an asMockFetch helper to model Bun’s augmented fetch shape in tests. |
| tests/security.test.ts | Ensures assertions compare against string values for branded HTML outputs. |
| tests/router.test.ts | Adds missing route typing and cleans up guard assertions under stricter checking. |
| tests/motion.test.ts | Improves startViewTransition mocking to match the DOM typing surface more closely. |
| tests/core.test.ts | Narrows nullable DOM values before dispatch/assertions for stricter typing. |
| tests/component.test.ts | Adds a type-level assertion that numeric state keys are rejected. |
| src/store/types.ts | Updates Actions typing to use ThisType and relaxes action function constraints. |
| src/store/watch.ts | Relaxes action constraints to accept specifically-typed action parameters. |
| src/store/persisted.ts | Same action constraint relaxation for persisted stores. |
| src/store/mapping.ts | Same action constraint relaxation for mapActions. |
| src/store/define-store.ts | Same action constraint relaxation for defineStore. |
| src/component/types.ts | Introduces ComponentStateKey and uses it for getState/setState key typing. |
| src/component/index.ts | Re-exports ComponentStateKey from the component entry point. |
| src/full.ts | Re-exports ComponentStateKey from the full bundle entry point. |
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com>
Applied in commit 6a8c264. |
There was a problem hiding this comment.
Pull request overview
This PR tightens TypeScript correctness across the project by expanding test-suite type-checking, fixing a subtle test environment shim issue, and refining public component/store typing so it better matches runtime behavior.
Changes:
- Expand
test:typescoverage to type-check the entiretests/tree and adjust affected tests to satisfy stricter typing. - Fix the
getComputedStyleglobal shim to use the correct receiver, aligning happy-dom behavior with browser semantics. - Refine public typings: add
ComponentStateKeyand constrain component state access to string keys; adjust store action typing to keep actions callable with specific parameter types.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.component-test.json | Expands type-check coverage from a single test file to the full tests/ directory. |
| tests/setup.ts | Binds window.getComputedStyle to ensure correct receiver semantics in the global shim. |
| tests/signal.test.ts | Adds a typed fetch mock helper compatible with Bun’s augmented fetch shape. |
| tests/store.test.ts | Adds explicit store generics so action signatures remain callable under broader test type-checking. |
| src/store/types.ts | Updates Actions typing to use ThisType and preserves specific action parameter typing. |
| src/store/watch.ts | Relaxes action generic constraints to allow specific action parameter types. |
| src/store/define-store.ts | Aligns action generic constraints with callable action signatures. |
| src/store/persisted.ts | Aligns action generic constraints with callable action signatures. |
| src/store/mapping.ts | Aligns action generic constraints with callable action signatures. |
| src/component/types.ts | Introduces ComponentStateKey and constrains typed getState/setState keys to strings. |
| src/component/index.ts | Re-exports ComponentStateKey as part of the public component API surface. |
| src/full.ts | Re-exports ComponentStateKey from the full bundle entrypoint. |
| tests/component.test.ts | Adds a type-level assertion ensuring numeric state keys are rejected. |
| tests/security.test.ts | Adjusts assertion to match branded/typed sanitize return values. |
| tests/utils.test.ts | Switches prototype-pollution assertions to a hasOwnProperty.call form that type-checks broadly. |
| tests/view.test.ts | Narrows signal object typing to allow property removal while maintaining type safety. |
| tests/router.test.ts | Improves guard typing/narrowing under expanded test type-checking. |
| tests/motion.test.ts | Updates startViewTransition mocking to match the DOM lib type and newer overload shape. |
| tests/core.test.ts | Tightens null assertions for DOM queries to satisfy stricter typing. |
* Add `bool()` support for boolean attributes in component templates (#55) Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jonas Pfalzgraf <info@josunlp.de> * Add typed state generics to component definitions (#56) Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jonas Pfalzgraf <info@josunlp.de> * Pass attribute change metadata to component `updated()` hooks (#58) Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jonas Pfalzgraf <info@josunlp.de> * Add per-component sanitizer overrides for component render output (#57) * Initial plan * feat: add per-component sanitizer options Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * docs: clarify component sanitizer baseline Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * docs: warn about sensitive component sanitizer opts Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * test: cover sanitizer allowTags overrides Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * perf: precompute component sanitizer allowlists Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> --------- Signed-off-by: Jonas Pfalzgraf <info@josunlp.de> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> Co-authored-by: Jonas Pfalzgraf <info@josunlp.de> * Pass previous props into component `beforeUpdate` (#59) * Initial plan * Add previous props to beforeUpdate hook Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * Refine beforeUpdate old props implementation Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * Fix beforeUpdate typing regressions Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> --------- Signed-off-by: Jonas Pfalzgraf <info@josunlp.de> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> Co-authored-by: Jonas Pfalzgraf <info@josunlp.de> * Add explicit signal subscriptions to `component()` renders (#60) * Initial plan * feat: add component signal subscriptions Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * chore: document signal subscription tracking Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * fix: address signal integration review feedback Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * fix: tighten component signal typing Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * fix: resolve eslint failure in component signal test Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * fix: handle reconnect lifecycle and signal effect errors Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * fix: preserve reconnect signal wiring after hook errors Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * fix: skip beforeUpdate for signal rerenders Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> --------- Signed-off-by: Jonas Pfalzgraf <info@josunlp.de> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> Co-authored-by: Jonas Pfalzgraf <info@josunlp.de> * Add trusted sanitized fragments for `safeHtml` composition (#61) * Initial plan * feat: add trusted safeHtml fragment support Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * chore: finalize trusted safeHtml support Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * docs: address trusted safeHtml review feedback Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * docs: fix second trusted safeHtml review follow-up Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * refactor: split trusted html helpers from sanitizer Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * refactor: tighten trusted html branding Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * docs: tighten trusted html internals Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> --------- Signed-off-by: Jonas Pfalzgraf <info@josunlp.de> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> Co-authored-by: Jonas Pfalzgraf <info@josunlp.de> * Reuse component shadow-root style nodes across re-renders (#62) * Initial plan * fix: reuse component style element on rerender Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * chore: finalize component style reuse fix Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * test: tighten style reuse regression assertions Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * Add `@bquery/bquery/storybook` template helpers for Storybook stories (#63) * Initial plan * feat: add storybook template helper Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * docs: clarify storybook when fallback behavior Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * fix: keep storybook helpers out of full bundle Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * fix: sanitize storybook helper output Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * test: tighten storybook helper security coverage Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * feat: enhance storyHtml with improved boolean attribute handling and sanitization tests * fix: update storyHtml example to reflect correct boolean attribute output * fix: defensive tag delimiter and parser comments per code review Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * chore: release version 1.6.0 - Update CHANGELOG.md for version 1.6.0 release notes including added features, changes, fixes, and security improvements. - Enhance README.md to document new boolean attribute helpers and Storybook integration. - Update bun.lock to reflect dependency upgrades for Storybook and happy-dom. - Modify definition.md to include new Storybook helpers and component state management features. - Revise components.md to demonstrate new boolean attribute handling and typed state in components. - Update getting-started.md with Storybook authoring examples and improved module descriptions. - Enhance security.md to clarify sanitization practices and introduce trusted fragment handling. - Revise index.md to highlight new Storybook helpers in the feature list. - Update llms.txt to reflect the new version 1.6.0. - Bump version in package.json to 1.6.0 and update devDependencies for Storybook. * Address review feedback for test setup, test type coverage, and component state keys (#65) * Initial plan * Address review feedback for test typing and setup Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * Finalize review feedback fixes Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * Export component state key type Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * Default component state key generic Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * Tighten component/state update semantics and Storybook attribute sanitization (#66) * Initial plan * fix review follow-up for state updates and storybook sanitization Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * fix storybook attribute value scanning Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * fix storybook interpolation boundary parsing Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * docs align storybook attribute scan jsdoc Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> --------- Signed-off-by: Jonas Pfalzgraf <info@josunlp.de> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…nent state keys (#65) * Initial plan * Address review feedback for test typing and setup Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * Finalize review feedback fixes Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * Export component state key type Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> * Default component state key generic Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com>
This updates the v1.6.0 branch to address the review-thread follow-ups around test environment correctness, incomplete test type-check coverage, and the public component state helper types. The main effect is that the existing
test:typesstep now checks the full test suite, and the typed component state API better matches runtime behavior.Test environment shim
getComputedStyleglobal setup to call the window method with the correct receiver instead of using an unbound function reference.Full test type-check coverage
tsconfig.component-test.jsonfrom a single component test file to the fulltests/tree.Component state helper typing
setState()/getState()keys to string keys only.ComponentStateKeyalias to make that contract explicit in the public type surface.Related typing cleanup surfaced by wider coverage
fetch.preconnectshape in tests.💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.