Skip to content

Instantly share code, notes, and snippets.

@StefanNieuwenhuis
Last active April 12, 2019 14:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save StefanNieuwenhuis/5deb022b044985fcaf58f859fea18a6b to your computer and use it in GitHub Desktop.
import { newE2EPage } from '@stencil/core/testing';
describe('my-component', () => {
let page, component, element;
beforeEach(async () => {
page = await newE2EPage();
await page.setContent('<my-component></my-component>');
component = await page.find('my-component');
element = await page.find('my-component >>> div');
});
it('renders', async () => {
expect(component).toHaveClass('hydrated');
});
it('renders a div, decorated with a class, called overlay', async () => {
expect(element).toHaveClass('overlay');
});
describe('open', () => {
it('should add the is-visible class to the overlay', async () => {
component.setProperty('open', true);
await page.waitForChanges();
expect(element).toHaveClass('is-visible');
});
it('should add the is-transparent class to the overlay, when the property is set', async () => {
component.setProperty('open', true);
component.setProperty('transparent', true);
await page.waitForChanges();
expect(element).toHaveClasses(['is-visible', 'is-transparent']);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment