ember-css-modules icon indicating copy to clipboard operation
ember-css-modules copied to clipboard

How to use in tests?

Open brunomacf opened this issue 4 years ago • 1 comments

Is there a way to test if a component got some local class in my own app tests? Suppose i have a component like this:

<div local-class="container {{if isLoaded 'loaded'}}">
   test
</div>

How can i implement a test that check if loaded class is in place?

brunomacf avatar May 13 '20 22:05 brunomacf

@brunomacf

I have started testing this condition by importing the styles object directly from the components module css.

import styles from 'my-app-name/components/my-component/styles.css';

assert.dom('.' + styles['loaded']).exists();

It would be nice if the styles object had something like a toSelector() function.

arenoir avatar Jul 02 '20 12:07 arenoir