Skip to content

Fix XPath arithmetic on element nodes; reorganize tests by topic#190

Merged
leonelsanchesdasilva merged 3 commits intomainfrom
issue-189
Mar 23, 2026
Merged

Fix XPath arithmetic on element nodes; reorganize tests by topic#190
leonelsanchesdasilva merged 3 commits intomainfrom
issue-189

Conversation

@leonelsanchesdasilva
Copy link
Copy Markdown
Collaborator

Closes #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 Math operations #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

 #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>
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

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/lib submodule 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>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 22, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
79.19% (+0.02% 🔼)
3352/4233
🟡 Branches
69.11% (+0.04% 🔼)
1969/2849
🟡 Functions 72.03% 394/547
🟡 Lines
79.33% (+0.02% 🔼)
3209/4045

Test suite run success

664 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>
@leonelsanchesdasilva leonelsanchesdasilva merged commit ff4f0bf into main Mar 23, 2026
3 checks passed
@leonelsanchesdasilva leonelsanchesdasilva deleted the issue-189 branch March 23, 2026 00:14
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.

Math operations

2 participants