diff --git a/packages/core/src/components/drawer/drawer.tsx b/packages/core/src/components/drawer/drawer.tsx index a31c11fee62..071e70272d3 100644 --- a/packages/core/src/components/drawer/drawer.tsx +++ b/packages/core/src/components/drawer/drawer.tsx @@ -146,6 +146,10 @@ export class Drawer { }); } + componentDidLoad() { + this.onShowChanged(this.show); + } + render() { return ( { + await mount(`Content`); + const drawer = page.locator('ix-drawer'); + await expect(drawer).toHaveClass(/hydrated/); + await expect(drawer).not.toBeVisible(); +}); + +test('show by property (initial)', async ({ mount, page }) => { + await mount(`Content`); + const drawer = page.locator('ix-drawer'); + await expect(drawer).toHaveClass(/hydrated/); + await expect(drawer).toBeVisible(); +}); + +test('show by property', async ({ mount, page }) => { + await mount(`Content`); + const drawer = page.locator('ix-drawer'); + + await drawer.evaluate( + (drawerElement: HTMLIxDrawerElement) => (drawerElement.show = true) + ); + + await expect(drawer).toHaveClass(/hydrated/); + await expect(drawer).toBeVisible(); +}); + +test('toggle by property', async ({ mount, page }) => { + await mount(`Content`); + const drawer = page.locator('ix-drawer'); + + await drawer.evaluate( + (drawerElement: HTMLIxDrawerElement) => (drawerElement.show = true) + ); + + await expect(drawer).toHaveClass(/hydrated/); + await expect(drawer).toBeVisible(); + + await drawer.evaluate( + (drawerElement: HTMLIxDrawerElement) => (drawerElement.show = false) + ); + + await expect(drawer).not.toBeVisible(); +});