Open elmariofredo opened 7 years ago
well yes and no ! :D
For these particular reason I just wished we had snapshot testing but YES we should definitely test projection because it's component API like props.
Hard question is how to test it because
template (shadow dom) of my-el
<div>
<h1>What is love?</h1>
<slot/>
</div>
usage:
<my-el><p>I'm Jony Bravo</p><p>Hello mama!</p></my-el>
result in DOM:
<my-el>
#shadowRoot
|- <div>
|-- <h1>What is love?</h1>
|-- refPointer to light dom -> <p>I'm Jony Bravo</p><p>Hello mama!</p>
|- </div>
<p>I'm Jony Bravo</p><p>Hello mama!</p>
</my-el>
template (shadow dom) of my-el
<div>
<h1>What is love?</h1>
<slot/>
</div>
usage:
<my-el><p>I'm Jony Bravo</p><p>Hello mama!</p></my-el>
result in DOM:
<my-el>
|- <div>
|-- <h1>What is love?</h1>
|-- <p>I'm Jony Bravo</p><p>Hello mama!</p>
|- </div>
</my-el>
So in non native we can just query but what about native?
any suggestions?
Current behavior Currently we don't test if element is properly slotted, so if someone will remove line test will still pass.
Expected behavior we should do at least basic slot testing specially for mutli slot components
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
Blaze-elements version: 1.1.X
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Language: [all | TypeScript X.X | ES6/7 | ES5]