Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion packages/calcite-components/src/components/select/select.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
themed,
} from "../../tests/commonTests";
import { html } from "../../../support/formatting";
import { findAll } from "../../tests/utils/puppeteer";
import { findAll, newProgrammaticE2EPage } from "../../tests/utils/puppeteer";
import { CSS } from "./resources";
import type { Select } from "./select";

Expand Down Expand Up @@ -422,6 +422,25 @@ describe("calcite-select", () => {
await assertSelectedOption(page, await page.find("calcite-option[value='']"));
});

it("does not throw when added and removed multiple times and a row", async () => {
const runTest = async () => {
async function addAndRemoveSelect(page: E2EPage): Promise<void> {
await page.evaluate(async () => {
const select = document.createElement("calcite-select");
document.body.append(select);
select.remove();
});
await page.waitForChanges();
}

const page = await newProgrammaticE2EPage();
await addAndRemoveSelect(page);
await addAndRemoveSelect(page);
};

await expect(runTest()).resolves.toBeUndefined();
});

describe("is form-associated", () => {
formAssociated(
html`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class Select

this.populateInternalSelect();

const selected = this.selectEl.selectedOptions[0];
const selected = this.selectEl?.selectedOptions[0];
this.selectFromNativeOption(selected);
afterConnectDefaultValueSet(this, this.selectedOption?.value ?? "");
}
Expand Down
Loading