Fix select multiple default value (#3953)
* Fix select multiple default value * Add a playwright test for select multiple
This commit is contained in:
1 parent
cbb91d694f
commit
5e9a505465
6 files changed
+73
-13
No files matched your search
@@ -155,3 +155,21 @@ test("document elements", async ({ page }) => {
|
||||
const main = page.locator("#main");
|
||||
await expect(main).toHaveCSS("font-family", "Roboto");
|
||||
});
|
||||
|
||||
test("select multiple", async ({ page }) => {
|
||||
await page.goto("http://localhost:9999");
|
||||
// wait until the select element is mounted
|
||||
const staticSelect = page.locator("select#static-multiple-select");
|
||||
await staticSelect.waitFor({ state: "attached" });
|
||||
await expect(staticSelect).toHaveValues([]);
|
||||
// Make sure the multiple attribute is actually set
|
||||
await staticSelect.selectOption(["1", "2"]);
|
||||
await expect(staticSelect).toHaveValues(["1", "2"]);
|
||||
|
||||
// The dynamic select element should act exactly the same
|
||||
const dynamicSelect = page.locator("select#dynamic-multiple-select");
|
||||
await dynamicSelect.waitFor({ state: "attached" });
|
||||
await expect(dynamicSelect).toHaveValues([]);
|
||||
await dynamicSelect.selectOption(["1", "2"]);
|
||||
await expect(dynamicSelect).toHaveValues(["1", "2"]);
|
||||
});
|
||||
Reference in new issue
Block a user