-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(panel, flow-item): add alerts slot #9778
Changes from all commits
f042e72
606b78a
0eea68e
d033146
bd3ad16
29a16f8
c9a2078
fe2e51e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,13 @@ import { | |
t9n, | ||
} from "../../tests/commonTests"; | ||
import { html } from "../../../support/formatting"; | ||
import { GlobalTestProps } from "../../tests/utils"; | ||
import { CSS, SLOTS } from "./resources"; | ||
|
||
type TestWindow = GlobalTestProps<{ | ||
beforeClose: () => Promise<void>; | ||
}>; | ||
|
||
describe("calcite-flow-item", () => { | ||
describe("renders", () => { | ||
renders("calcite-flow-item", { display: "flex" }); | ||
|
@@ -210,8 +215,7 @@ describe("calcite-flow-item", () => { | |
|
||
await page.$eval( | ||
"calcite-flow-item", | ||
(el: HTMLCalciteFlowItemElement) => | ||
(el.beforeClose = (window as typeof window & Pick<typeof el, "beforeClose">).beforeClose), | ||
(el: HTMLCalciteFlowItemElement) => (el.beforeClose = (window as TestWindow).beforeClose), | ||
); | ||
|
||
await page.waitForChanges(); | ||
|
@@ -327,4 +331,21 @@ describe("calcite-flow-item", () => { | |
expect(toggleSpy).toHaveReceivedEventTimes(1); | ||
expect(await panel.getProperty("closed")).toBe(true); | ||
}); | ||
|
||
it("should set embedded on slotted alerts", async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is testing an internal prop. If screenshot tests cover this, we should drop this (and similar) tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Screenshot tests do cover this, but I do think this adds some protection. |
||
const page = await newE2EPage({ | ||
html: html`<calcite-flow-item closable> | ||
test | ||
<calcite-alert slot="alerts" open label="this is a default alert"> | ||
<div slot="title">Hello there!</div> | ||
<div slot="message">This is an alert with a general piece of information. Cool, innit?</div> | ||
</calcite-alert> | ||
</calcite-flow-item>`, | ||
}); | ||
await page.waitForChanges(); | ||
|
||
const alert = await page.find("calcite-alert"); | ||
|
||
expect(await alert.getProperty("embedded")).toBe(true); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid testing internal props unless there's a strong use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's an internal prop, but we should still test it to expect it to be false by default IMO. This adds protection from someone removing it accidentally or its value being changed.