fix(mock-doc): add missing part setter to MockElement#6612
Merged
johnjenkins merged 1 commit intostenciljs:mainfrom Feb 23, 2026
Merged
fix(mock-doc): add missing part setter to MockElement#6612johnjenkins merged 1 commit intostenciljs:mainfrom
part setter to MockElement#6612johnjenkins merged 1 commit intostenciljs:mainfrom
Conversation
The `part` getter added in stenciljs#6423 had no setter, causing `setAccessor` to overwrite it on custom elements instead of setting the attribute.
Contributor
There was a problem hiding this comment.
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 toMockElementthat callssetAttributeNSto properly handle thepartattribute - Added regression tests verifying that the
partattribute 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.
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.
What is the current behavior?
MockElement.parthas a getter but no setter. WhensetAccessordoeselm.part = "value"on custom elements, it overwrites the getter with a plain string on the instance.setAttributeis never called and thepartattribute is silently lost in spec test snapshots.GitHub Issue Number: #6611
What is the new behavior?
Closes #6611
Added a
set part()setter toMockElement, matching howclassName/classListwork. Thepartattribute now correctly appears on custom elements in spec tests.Documentation
N/A
Does this introduce a breaking change?
Testing
Added some regression tests
closes #6611