Skip to content

Commit

Permalink
add broken test case
Browse files Browse the repository at this point in the history
  • Loading branch information
WickyNilliams committed Dec 14, 2024
1 parent 6a9b205 commit d95a001
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
display: flex;
gap: 1em;
}
#simple2::part(slot) {
display: flex;
gap: 1em;
}
</style>
</head>
<body>
Expand Down Expand Up @@ -109,6 +113,11 @@ <h2>Simple date</h2>

<calendar-date id="simple" months="3"></calendar-date>

<calendar-date id="simple2" months="3">
<span slot="previous">&lt;</span>
<span slot="next">&gt;</span>
</calendar-date>

<script type="module">
import "./src/index.ts";

Expand Down
14 changes: 14 additions & 0 deletions src/calendar-date/calendar-date.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -821,5 +821,19 @@ describe("CalendarDate", () => {
calendar.shadowRoot!.querySelector("slot:not([name])")!.children
).to.have.lengthOf(0);
});

it("behaves correctly when named slots are used", async () => {
const calendar = await mount(
<CalendarDate locale="en-GB" months={2} value="2024-11-02">
<span slot="prev">&lt;</span>
<span slot="next">&gt;</span>
</CalendarDate>
);
const months = getMonths(calendar);

expect(months).to.have.lengthOf(2);
expect(getMonthHeading(months[0]!)).to.have.text("November");
expect(getMonthHeading(months[1]!)).to.have.text("December");
});
});
});

0 comments on commit d95a001

Please sign in to comment.