Skip to content

Commit

Permalink
fix(panel): initially closed panel should be hidden (#10308)
Browse files Browse the repository at this point in the history
**Related Issue:** #10320

## Summary

- panel that is initially closed should not be displayed
- add story
- add test
  • Loading branch information
driskull authored Sep 16, 2024
1 parent 62259d1 commit 46de96b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/calcite-components/src/components/panel/panel.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,18 @@ describe("calcite-panel", () => {
expect(await container.isVisible()).toBe(false);
});

it("honors closed prop initially", async () => {
const page = await newE2EPage();

await page.setContent("<calcite-panel closed closable>test</calcite-panel>");

const container = await page.find(`calcite-panel >>> .${CSS.container}`);

await page.waitForChanges();

expect(await container.isVisible()).toBe(false);
});

it("should handle rejected 'beforeClose' promise'", async () => {
const page = await newE2EPage();

Expand Down
1 change: 1 addition & 0 deletions packages/calcite-components/src/components/panel/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ export class Panel

async componentWillLoad(): Promise<void> {
setUpLoadableComponent(this);
this.isClosed = this.closed;
await setUpMessages(this);
}

Expand Down

0 comments on commit 46de96b

Please sign in to comment.