Fix XPath arithmetic on element nodes; reorganize tests by topic#190
Merged
leonelsanchesdasilva merged 3 commits intomainfrom Mar 23, 2026
Merged
Fix XPath arithmetic on element nodes; reorganize tests by topic#190leonelsanchesdasilva merged 3 commits intomainfrom
leonelsanchesdasilva merged 3 commits intomainfrom
Conversation
#189) Bump src/xpath/lib submodule to 1e9b871: - Add node-utils.ts with getStringValueFromNode() helper - Fix atomize() in arithmetic-expression.ts and unary-expression.ts to extract text content from DOM nodes before numeric conversion, fixing expressions like `number + 1` returning NaN when `number` is a child element (issue #189) Rename issue-specific test files to topic-based names: - issue-183.test.ts → template-match.test.ts - issue-187.test.ts → copy-of.test.ts - issue-189.test.ts → arithmetic.test.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the XPath submodule to fix numeric coercion of DOM element nodes in arithmetic expressions (addressing #189) and reorganizes XSLT tests to be topic-based.
Changes:
- Bump
src/xpath/libsubmodule to include node string-value extraction fixes for arithmetic/unary expressions. - Add a new arithmetic-focused test suite covering XPath arithmetic with element/attribute nodes.
- Retitle/refactor existing “issue-*” XSLT tests toward topic-based organization and shared setup.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/xslt/issue-187.test.ts | Retitles suite to focus on xsl:copy-of behavior (comment stability). |
| tests/xslt/issue-183.test.ts | Retitles suite to template match patterns and refactors setup via beforeEach. |
| tests/xslt/arithmetic.test.ts | Adds coverage for arithmetic operators and node-to-number coercion cases tied to #189. |
| src/xpath/lib | Updates submodule pointer to bring in XPath arithmetic coercion fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Having both copy-of.test.ts and copy-of.test.tsx in the same directory caused a TypeScript module name collision, making ts-jest fail with a misleading "outDir" error in CI. Merged the comment-stability tests (from issue #187) into the existing copy-of.test.tsx and removed the duplicate .ts file. Also unified the import to use src/index for consistency. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Coverage report
Test suite run success664 tests passing in 65 suites. Report generated by 🧪jest coverage report action from 926f0cc |
- Replace resolves.not.toThrow() with a plain await — toThrow() expects a function, not a resolved value (Copilot review #190) - Update the empty node-set comment to accurately describe XPath 1.0 behavior rather than attributing it to XPath 2.0 semantics Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Closes #189
Bump src/xpath/lib submodule to 1e9b871:
number + 1returning NaN whennumberis a child element (issue Math operations #189)Rename issue-specific test files to topic-based names: