Skip to content

fix(mock-doc): add missing part setter to MockElement#6612

Merged
johnjenkins merged 1 commit intostenciljs:mainfrom
hyyan:main
Feb 23, 2026
Merged

fix(mock-doc): add missing part setter to MockElement#6612
johnjenkins merged 1 commit intostenciljs:mainfrom
hyyan:main

Conversation

@hyyan
Copy link
Contributor

@hyyan hyyan commented Feb 23, 2026

What is the current behavior?

MockElement.part has a getter but no setter. When setAccessor does elm.part = "value" on custom elements, it overwrites the getter with a plain string on the instance. setAttribute is never called and the part attribute is silently lost in spec test snapshots.

GitHub Issue Number: #6611

What is the new behavior?

Closes #6611

Added a set part() setter to MockElement, matching how className/classList work. The part attribute now correctly appears on custom elements in spec tests.

Documentation

N/A

Does this introduce a breaking change?

  • Yes
  • No

Testing

Added some regression tests

closes #6611

The `part` getter added in stenciljs#6423 had no setter, causing `setAccessor`
to overwrite it on custom elements instead of setting the attribute.
Copilot AI review requested due to automatic review settings February 23, 2026 14:29
@hyyan hyyan requested a review from a team as a code owner February 23, 2026 14:29
Copy link
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

This PR fixes a bug where the part attribute was silently lost on custom elements in spec tests. The issue occurred because MockElement.part had only a getter without a corresponding setter, causing setAccessor to overwrite the getter with a plain string value instead of properly setting the attribute.

Changes:

  • Added a set part() setter to MockElement that calls setAttributeNS to properly handle the part attribute
  • Added regression tests verifying that the part attribute is correctly set, updated, and removed on custom elements

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/mock-doc/node.ts Added setter for part property to properly set the attribute via setAttributeNS
src/runtime/vdom/test/set-accessor.spec.ts Added three test cases covering setting, updating, and removing the part attribute

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@johnjenkins johnjenkins left a comment

Choose a reason for hiding this comment

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

LGTM!

@johnjenkins johnjenkins added this pull request to the merge queue Feb 23, 2026
Merged via the queue into stenciljs:main with commit abfdd57 Feb 23, 2026
72 of 73 checks passed
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.

bug: part attribute not set on custom elements in spec tests

3 participants