Open prateekjadhwani opened 5 years ago
I wonder if you solved your issue.
Nope, sorry. If you have any suggestions, i would love to hear them.
Sorry no. Im desperately searching for a webComponent testing lib to integrate with our mocha setup with no avail
Lol... same I totally understand your pain. I have been searching for months.
@prateekjadhwani
your component does not have static get observedAttributes
and therefore does not reacts to changes in the attribute.
Could you try again?
also, anything related to DOM should not be reached from the constructor (unless there is a shadow root).
You can try reproducing this without the test runner, just start showroom and browse to localhost:3000
@prateekjadhwani Did that work for you?
Sorry @eavichay I havent tried it. I will give it a try this weekend. Are there more examples in the documentation that I can reference? As in for complex and nested components?
@prateekjadhwani
in your showroom file /.showroom/my-component.showroom.js
add to the default export outerHTML
property with anything you want.
for example:
<div>
<my-component>
<my-nested-component></my-nested-component>
</my-component>
</div>```
Showroom will identify your component within the markup and attach listeners/commands to it. The nested component, however will not be part of the scenario. You can add custom methods to interact with it if required.
Hi there,
I have a web component HeaderImage.js which looks something like this
And I would like to write a unit test to check the following:
altText
is getting set in the beginningsrc
is getting set in the beginningaltText
is empty string or null, the functionhandleErrors()
is getting called.I have been trying for the past few days now, and I havent been able to understand how I can check these. I was wondering if someone would be able to help me out.
I really dont know what I am doing here, but here is the code:
HeaderImage.showroom.js
file inside.showroom
folderHeaderImage.spec.js
intest
folderThe error that I see in Mocha is
I really have no clue what is going on here. And I dont know what I am missing here. Sorry :( Any help is appreciated. Thanks