salesforce/sfdx-lwc-jest

[LWC warn]: Unknown public property * of element *. This is either a typo on the corresponding attribute "*", or the attribute does not exist in this browser or DOM implementation.

AllanOricil opened this issue · 3 comments

Description

Why does this warning message appear if the property is in the child element?

@nolanlawson could you help to understand why this issue happens. I know this "warning" happens in the following module, but I can't figure out the problem

at patchProps (/Users/allanoricil/sf-metadata/node_modules/@salesforce/sfdx-lwc-jest/node_modules/@lwc/engine-dom/dist/engine-dom.cjs.js:3788:21)

child

child.js

....
@api
userData

parent

parent.js

....
userData = {}

parent.html

<template>
   <c-child user-data={userData}></c-child>
</template>

Version

  • @salesforce/sfdx-lwc-jest: 1.0.1~1.3.0
  • Node: 16.10.0

Possible Solution

none

Additional context/Screenshots

image

the userData prop is declared in the child and exposed using @api, but when running tests, the engine-dom.cjs can't find this public property in the elm. This is how the child element is used in the parent component.

image

image

In this image you can see the moment when the warning appears for the userData property of the child component.
image

In the following images you can see that accountData and recordData properties are present in the elm, while the prop called userData isn't.

image

image

image

In this image you can see that the userData prop is in vnode.data.

image

Why isn't theuserData prop present in elm like the other two properties, if all three props are exposed with @api?

A mock was used instead of the actual component. And userData was missing in the mock...
image
image