DEV Community

loading...

Discussion on: Testing Web Components with Karma, Mocha & Chai

Collapse
jfbrennan profile image
Jordan Brennan • Edited

What is the difference between const el = await fixture(html`<my-element></my-element>`) and const element = document.createElement('my-element')? Why wouldn't document.createElement work in both cases?

P.S. Your code samples don't have syntax highlighting

Collapse
sinhapiyush profile image
Piyush Sinha Author

Both works in the given scenario. Actually, I wanted to introduce a test fixture as well. By default, fixture awaits the el.updateComplete() which is not the case for document.createElement().

And I'm new to dev.to platform. Can you guide me on how to add syntax highlighting?

Collapse
jfbrennan profile image
Jordan Brennan • Edited

Ah, updateComplete. Makes sense

Add javascript To the end of the first three backticks

Thread Thread
sinhapiyush profile image