Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
@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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!