Last active
April 12, 2019 14:34
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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