Skip to content

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

@hyyan

Description

@hyyan

Prerequisites

Stencil Version

v4.38.2

Current Behavior

When a component renders a child custom element with a part attribute, the attribute is silently lost in spec test output. Snapshots show the part missing entirely.

This happens because MockElement.part (added in #6423) has a getter but no setter. setAccessor sees 'part' in elm is true and does elm.part = "value", which overwrites the getter with a plain string on the instance. setAttribute is never called.

Expected Behavior

The part attribute should appear on custom elements in spec test snapshots, matching real browser behavior.

System Info

Steps to Reproduce

  1. Create a component that renders a child custom element with part
  2. Write a spec test with newSpecPage and snapshot the output
  3. The part attribute is missing from the child custom element

Code Reproduction URL

N/A

Additional Information

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions