Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jcfranco committed Jan 25, 2025
1 parent 481edcc commit 8eff3e0
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,26 @@ describe("calcite-combobox", () => {
expect(await item2.getProperty("selected")).toBe(true);
expect(eventSpy).toHaveReceivedEventTimes(1);
});

it("updates the value immediately after selecting an item programmatically", async () => {
const page = await newE2EPage();
await page.setContent(html`
<calcite-combobox selection-mode="single">
<calcite-combobox-item value="1" text-label="first"></calcite-combobox-item>
<calcite-combobox-item value="2" text-label="second"></calcite-combobox-item>
<calcite-combobox-item value="3" text-label="third"></calcite-combobox-item>
</calcite-combobox>
`);

const immediateValueAfterSelected = await page.evaluate(async () => {
const combobox = document.querySelector("calcite-combobox");
const firstItem = document.querySelector("calcite-combobox-item");
firstItem.selected = true;
return combobox.value;
});

expect(immediateValueAfterSelected).toBe("1");
});
});

describe("clearing values", () => {
Expand Down

0 comments on commit 8eff3e0

Please sign in to comment.