stencil icon indicating copy to clipboard operation
stencil copied to clipboard

bug: `MockHTMLElement` class is missing `localName` property

Open DarioSacco opened this issue 1 year ago • 1 comments

Prerequisites

Stencil Version

4.12.1

Current Behavior

When running tests with stencil test --specs , the localName of an elements (converted to a MockHTMLElement) is undefined. I'm using the dialog-polyfill library that relies on the localName when checking if an element is a dialog.

Expected Behavior

The mocked html element to have the correct localName

System Info

System: node 18.19.0
    Platform: darwin (23.2.0)
   CPU Model: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 cpus)
    Compiler: node_modules/@stencil/core/compiler/stencil.js
       Build: 1707148558
     Stencil: 4.12.1 🏸
  TypeScript: 5.3.3
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.27.0

Steps to Reproduce

Throw an error in a tested component checking for localName on an element reference

if (!this.elementRef.localName) {
      throw new Error("Error");
}

or run yarn test in the linked repo

Code Reproduction URL

https://github.com/DarioSacco/stencil-mockhtmlelement-localname-bug

Additional Information

No response

DarioSacco avatar Feb 09 '24 16:02 DarioSacco

Thanks! I've ingested this into our backlog for the team to take a look at. I think this would make a good first PR if anyone were interested in contributing to Stencil - accepting PRs!

rwaskiewicz avatar Feb 09 '24 18:02 rwaskiewicz

A fix for this issue has been included as a part of today's Stencil v4.14.0 release 🎉

I'm going to close this issue out, thanks again!

rwaskiewicz avatar Apr 01 '24 14:04 rwaskiewicz