Skip to content

Commit

Permalink
test(notification): implement notification tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ogunb committed Nov 15, 2023
1 parent 082c1ec commit 2ecad4a
Show file tree
Hide file tree
Showing 5 changed files with 592 additions and 33 deletions.
1 change: 1 addition & 0 deletions src/components/alert/bl-alert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ describe("Slot", () => {

expect(el.outerHTML).to.eq('<bl-alert variant="info"></bl-alert>');
});
it.todo("renders action slots from fallthrough slots");
});

describe("Events", () => {
Expand Down
10 changes: 7 additions & 3 deletions src/components/alert/bl-alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,13 @@ export default class BlAlert extends LitElement {

// Allow fallthrough slots. ref: bl-notification-card.ts
if (slotElements.some(element => element.tagName === "SLOT")) {
slotElements = slotElements.flatMap(element =>
(element as HTMLSlotElement).assignedElements()
);
slotElements = slotElements.flatMap(element => {
if (element.tagName === "SLOT") {
return (element as HTMLSlotElement).assignedElements();
}

return element;
});
}

slotElements.forEach(element => {
Expand Down
Loading

0 comments on commit 2ecad4a

Please sign in to comment.