Skip to content

Commit 9b6a67b

Browse files
committed
test(select): add missed tests
1 parent b884bbd commit 9b6a67b

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/components/select/bl-select.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe("bl-select", () => {
132132

133133
const selectedOptions = el.shadowRoot?.querySelector<HTMLUListElement>(".selected-options");
134134

135-
expect(selectedOptions?.children[0].children[0]).to.equal("<bl-icon name=\"info\"></bl-icon>");
135+
expect(selectedOptions?.children[0].children[0].outerHTML).to.equal("<bl-icon name=\"info\"></bl-icon>");
136136
});
137137
it("should open select menu", async () => {
138138
const el = await fixture<BlSelect>(html`<bl-select><bl-select-option value="1">Option 1</bl-select-option></bl-select>`);

src/components/select/option/bl-select-option.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assert, elementUpdated, fixture, expect, html, oneEvent } from "@open-wc/testing";
1+
import { assert, elementUpdated, expect, fixture, html, oneEvent } from "@open-wc/testing";
22
import { sendKeys } from "@web/test-runner-commands";
33
import BlSelectOption from "./bl-select-option";
44

@@ -15,6 +15,8 @@ describe("bl-select", () => {
1515
expect(el).shadowDom.equal(
1616
`<div class="option-container">
1717
<div class="focus-target single-option" role="option" aria-selected="false">
18+
<slot name="icon">
19+
</slot>
1820
<slot>
1921
</slot>
2022
</div>
@@ -41,6 +43,14 @@ describe("bl-select", () => {
4143
);
4244
});
4345

46+
it("should rendered with custom icon", async () => {
47+
const el = await fixture<BlSelectOption>(html`<bl-select-option><bl-icon slot="icon" name="info"></bl-icon></bl-select-option>`);
48+
49+
const iconSlot = el.shadowRoot!.querySelector<HTMLSlotElement>("slot[name=icon]")!;
50+
51+
expect(iconSlot.assignedElements()).deep.equal([el.querySelector("bl-icon")]);
52+
});
53+
4454
it("should have aria-selected attribute set to true if the option is selected", async function () {
4555
const el = await fixture<BlSelectOption>(
4656
html`<bl-select-option value="basketball" selected>Basketball</bl-select-option>`

0 commit comments

Comments
 (0)