DEV Community

Discussion on: Testing Workflow for Web Components

Collapse
 
dakmor profile image
Thomas Allmer

thxxxx ❤️

you are correct - using updateComplete will make the test pass. And in tests I use updateComplete a lot :) even the fixture itself relies on it 💪

However, setting properties is usually not an async action. So you would need to know that it's async and then you would need to know how to await this async-ness.

For logging it could be ok to stay async, unless you are actually logging timings 🙈

However other things

el.firstName = 'Foo';
el.lastName = 'Bar';
// would require an await el.updateComplete; if it's async
if (el.fullName === 'Foo Bar') { ... }

really would feel strange if they only work if you await an rendering update?
the "calculation" of a fullName should not depend on the updates of the dom.

I hope this makes it a little more clear 🤗
you can also read more in the original issue: github.com/Polymer/lit-element/iss...

Collapse
 
dj profile image
Daniel J. Lauk

Ah yes, I see what you mean now. Thanks for the added details.

I even had a look at the issue before I wrote my comment, but I just didn't get it in its entirety 🙈