Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
@open-wc/testing - TypeError: Cannot set properties of undefined (setting 'hidden')

I am running a unit test on a web component that has been built with lit. The test is failing when hitting the firstUpdated() function. The issue looks to be related to this.tooltip.hidden and tooltip being undefined.

The code itself is working as expected and is showing/hiding the element, however when running the unit test it is failing to see the tooltip element.

Does anyone have any ideas?

Component code:

@query('.tooltip') 
tooltip: HTMLElement;

firstUpdated() {
  this.tooltip.hidden = !this.open; 
}

Unit test code:

it('should render its children', async () => {
  const content = 'Content'
  const el = await fixture<Tooltip>(html`<qg-tooltip>${content}</qg-tooltip>`)
  expect(el).to.contain.html(content)
});

Error received:

 TypeError: Cannot set properties of undefined (setting 'hidden')
    at Tooltip.firstUpdated (src/components/tooltip/Tooltip.ts:63:17)
    at Tooltip._$AE (../../node_modules/@lit/reactive-element/src/reactive-element.ts:1350:11)
    at Tooltip.performUpdate (../../node_modules/@lit/reactive-element/src/reactive-element.ts:1317:11)
    at Tooltip.scheduleUpdate (../../node_modules/@lit/reactive-element/src/reactive-element.ts:1235:16)
    at Tooltip._$E_ (../../node_modules/@lit/reactive-element/src/reactive-element.ts:1207:24)
    at async elementUpdated (../../node_modules/@open-wc/testing-helpers/src/elementUpdated.js:24:5)
    at async litFixture (../../node_modules/@open-wc/testing-helpers/src/litFixture.js:63:3)
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda