Skip to content
This repository has been archived by the owner on Jan 11, 2018. It is now read-only.

Should we test that element is slotted properly? #238

Open
elmariofredo opened this issue Mar 6, 2017 · 1 comment
Open

Should we test that element is slotted properly? #238

elmariofredo opened this issue Mar 6, 2017 · 1 comment

Comments

@elmariofredo
Copy link
Collaborator

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]
@Hotell
Copy link
Collaborator

Hotell commented Mar 6, 2017

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

in native browsers

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>

in non native browsers

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants