Add tests for router, store, and view modules#14
Merged
JosunLP merged 10 commits intodevelopmentfrom Jan 24, 2026
Merged
Conversation
Security and Playground Fixes: * Replaced direct assignment of HTML via `innerHTML` with safer DOM manipulation in the `logEvent` function within `playground/src/demos/core.ts` to prevent possible HTML injection vulnerabilities. * Updated collection handling in the same file to use the raw DOM element when re-appending items, improving code clarity and safety. Workflow and Versioning: * Added explicit `contents: read` permissions to both `build` and `build-docs` jobs in `.github/workflows/npm-publish.yml` to comply with GitHub Actions best practices. [[1]](diffhunk://#diff-8a5ce8b612395836520d0655143f732d08e747af57f3cfe76b5e283600106240R16-R17) [[2]](diffhunk://#diff-8a5ce8b612395836520d0655143f732d08e747af57f3cfe76b5e283600106240R29-R30) * Bumped package version to `1.1.1` in `package.json` to reflect the new release. * Added a changelog entry for version `1.1.1` noting the HTML handling fix in `CHANGELOG.md`.
Version 1.1.2
… new modules - Created `router.test.ts` to test router module exports and functionality. - Created `store.test.ts` to test store creation, state management, actions, and persistence. - Created `view.test.ts` to test view rendering, directives, and template creation. - Updated `vite.config.ts` to include new router, store, and view modules for bundling.
…odules; bump version to 1.2.0
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces three major new modules to bQuery.js: Router (SPA client-side routing), Store (signal-based state management), and View (declarative DOM bindings). However, there's a significant discrepancy: the PR title states "Add tests for router, store, and view modules" but the changes include full implementations of these modules, comprehensive test suites, and extensive documentation updates.
Changes:
- Three new feature modules with complete TypeScript implementations (~2,000+ lines of code)
- Comprehensive test suites for Store and View modules; minimal tests for Router
- Full documentation guides for all three modules
- Updated README, CHANGELOG, build configuration, and package.json
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| src/router/index.ts | New SPA router implementation with History API, route matching, guards (673 lines) |
| src/store/index.ts | New Pinia-style state management with signals, getters, actions (640 lines) |
| src/view/index.ts | New declarative DOM binding system with Vue/Alpine-style directives (710 lines) |
| tests/router.test.ts | Minimal export verification tests only - needs expansion |
| tests/store.test.ts | Comprehensive store tests covering all features |
| tests/view.test.ts | Comprehensive view tests covering all directives |
| vite.config.ts | Added build entries for new modules |
| package.json | Version bump to 1.2.0, added module exports |
| src/index.ts, src/full.ts | Export new modules |
| docs/guide/router.md | Complete router documentation with examples |
| docs/guide/store.md | Complete store documentation with examples |
| docs/guide/view.md | Complete view documentation with examples |
| docs/.vitepress/config.ts | Added navigation links for new guides |
| README.md | Added module descriptions and usage examples |
| CHANGELOG.md | Detailed 1.2.0 release notes |
…pport - Updated the query parameter structure to support multi-value keys, allowing duplicate query parameters to be stored as arrays. - Enhanced the `parseQuery` function to correctly handle and return multi-value query parameters. - Added tests to verify the correct parsing of single and multiple query parameters, including edge cases with duplicates. feat(signal): add peek method to Computed class - Introduced a `peek` method in the `Computed` class to read the current computed value without tracking dependencies. - This method allows access to the cached value while avoiding unnecessary reactivity. feat(store): implement state proxy for lazy signal reading - Created a state proxy using `Proxy` to lazily read signal values, improving performance by avoiding unnecessary object creation. - Updated the `getCurrentState` method to return a shallow copy of the state for subscriber notifications. fix(view): add security warnings for dynamic expression evaluation - Added security considerations to the view module regarding the use of `new Function()` for evaluating expressions. - Emphasized the importance of using trusted sources for expressions to mitigate security risks. test(router): implement comprehensive router tests with mocked history - Developed a suite of tests for the router module, including route matching, parameter extraction, query string parsing, and navigation functionality. - Mocked the History API to facilitate testing in environments without full browser support. test(store): update store tests to skip localStorage tests if not available - Modified store tests to conditionally skip tests that require localStorage when it is not available, improving test reliability across environments.
…mples test(signal): add tests for peek functionality in computed signals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces comprehensive documentation and README updates for three major new modules in the project: Router, Store, and View. These changes provide users with detailed usage guides, API references, and examples for each module, and integrate them into the main documentation and project overview.
Major documentation additions and updates:
Router, Store, and View documentation:
docs/guide/router.md) and Store (docs/guide/store.md) modules, covering setup, API, usage examples, and type references. [1] [2]Changelog and release notes:
CHANGELOG.mdwith a new section for version 1.2.0, summarizing the addition of the Router, Store, and View modules and their key features.These updates ensure that developers have clear guidance and reference material for using the new SPA routing, state management, and declarative DOM binding features.