-
Notifications
You must be signed in to change notification settings - Fork 78
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
fix(block): fix rendering tied to named-slot content #10449
Changes from 2 commits
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 |
---|---|---|
|
@@ -186,26 +186,25 @@ describe("calcite-block", () => { | |
|
||
it("can display/hide content", async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent("<calcite-block><div>some content</div></calcite-block>"); | ||
let element = await page.find("calcite-block"); | ||
let content = await page.find(`calcite-block >>> .${CSS.content}`); | ||
await page.setContent( | ||
html`<calcite-block heading="heading" description="description"><div>Hello world!</div></calcite-block>`, | ||
); | ||
await skipAnimations(page); | ||
await page.waitForChanges(); | ||
|
||
const element = await page.find("calcite-block"); | ||
const content = await page.find(`calcite-block >>> section.${CSS.content}`); | ||
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. I found something weird here. When using the 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. I agree it can be confusing, but this is working as expected (see https://stenciljs.com/docs/end-to-end-testing#find-an-element-in-the-shadow-dom). This also came up in a Stencil issue. 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. Interesting. I didn't know it searched all shadow roots. good to know! |
||
expect(content).not.toBeNull(); | ||
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. These assertions should already be covered in other tests. |
||
expect(await element.getProperty("open")).toBe(false); | ||
expect(await content.isVisible()).toBe(false); | ||
|
||
element.setProperty("open", true); | ||
await page.waitForChanges(); | ||
element = await page.find("calcite-block[open]"); | ||
content = await page.find(`calcite-block >>> .${CSS.content}`); | ||
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. ✨🧹✨ |
||
|
||
expect(element).toBeTruthy(); | ||
expect(await content.isVisible()).toBe(true); | ||
|
||
element.setProperty("open", false); | ||
await page.waitForChanges(); | ||
element = await page.find("calcite-block[open]"); | ||
content = await page.find(`calcite-block >>> .${CSS.content}`); | ||
|
||
expect(element).toBeNull(); | ||
expect(await content.isVisible()).toBe(false); | ||
}); | ||
|
||
|
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.
This
waitForChanges
shouldn't be necessary.