-
Notifications
You must be signed in to change notification settings - Fork 81
feat(combobox): append custom values to top of dropdown #9817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aPreciado88
merged 2 commits into
dev
from
aPreciado88/7288-append-custom-values-to-top-of-combobox-dropdown
Jul 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -875,7 +875,7 @@ describe("calcite-combobox", () => { | |
| await input.press("Enter"); | ||
| await page.waitForChanges(); | ||
|
|
||
| const item = await page.find("calcite-combobox-item:last-child"); | ||
| const item = await page.find("calcite-combobox-item:first-child"); | ||
| expect(await item.getProperty("textLabel")).toBe("K"); | ||
|
|
||
| const combobox = await page.find("calcite-combobox"); | ||
|
|
@@ -889,8 +889,8 @@ describe("calcite-combobox", () => { | |
| await skipAnimations(page); | ||
| await page.setContent(html` | ||
| <calcite-combobox allow-custom-values selection-mode="single"> | ||
| <calcite-combobox-item selected id="one" value="one" text-label="one"></calcite-combobox-item> | ||
| <calcite-combobox-item id="two" value="two" text-label="two"></calcite-combobox-item> | ||
| <calcite-combobox-item id="one" value="one" text-label="one"></calcite-combobox-item> | ||
| <calcite-combobox-item selected id="two" value="two" text-label="two"></calcite-combobox-item> | ||
| <calcite-combobox-item id="three" value="three" text-label="three"></calcite-combobox-item> | ||
| </calcite-combobox> | ||
| `); | ||
|
|
@@ -902,23 +902,23 @@ describe("calcite-combobox", () => { | |
| await input.press("Enter"); | ||
| await page.waitForChanges(); | ||
|
|
||
| const item1 = await page.find("calcite-combobox-item#one"); | ||
| const item2 = await page.find("calcite-combobox-item:last-child"); | ||
| const item1 = await page.find("calcite-combobox-item:first-child"); | ||
| const item2 = await page.find("calcite-combobox-item#two"); | ||
|
|
||
| expect(await item2.getProperty("textLabel")).toBe("K"); | ||
| expect(await item1.getProperty("textLabel")).toBe("K"); | ||
|
|
||
| expect((await combobox.getProperty("selectedItems")).length).toBe(1); | ||
| expect(await item1.getProperty("selected")).toBe(false); | ||
| expect(await item2.getProperty("selected")).toBe(true); | ||
| expect(await item1.getProperty("selected")).toBe(true); | ||
| expect(await item2.getProperty("selected")).toBe(false); | ||
| }); | ||
|
|
||
| it("should auto-select new custom values in multiple selection mode", async () => { | ||
| const page = await newE2EPage(); | ||
| await page.setContent(html` | ||
| <calcite-combobox allow-custom-values> | ||
| <calcite-combobox-item selected id="one" value="one" text-label="one"></calcite-combobox-item> | ||
| <calcite-combobox-item id="one" value="one" text-label="one"></calcite-combobox-item> | ||
| <calcite-combobox-item selected id="two" value="two" text-label="two"></calcite-combobox-item> | ||
| <calcite-combobox-item id="three" value="three" text-label="three"></calcite-combobox-item> | ||
| <calcite-combobox-item selected id="three" value="three" text-label="three"></calcite-combobox-item> | ||
| </calcite-combobox> | ||
| `); | ||
| const combobox = await page.find("calcite-combobox"); | ||
|
|
@@ -930,9 +930,9 @@ describe("calcite-combobox", () => { | |
| await input.press("Escape"); | ||
| await page.waitForChanges(); | ||
|
|
||
| const item1 = await page.find("calcite-combobox-item#one"); | ||
| const item1 = await page.find("calcite-combobox-item:first-child"); | ||
| const item2 = await page.find("calcite-combobox-item#two"); | ||
| const item3 = await page.find("calcite-combobox-item:last-child"); | ||
| const item3 = await page.find("calcite-combobox-item#three"); | ||
| const chips = await page.findAll("calcite-combobox >>> calcite-chip"); | ||
|
|
||
| expect((await combobox.getProperty("selectedItems")).length).toBe(3); | ||
|
|
@@ -1668,6 +1668,28 @@ describe("calcite-combobox", () => { | |
| expect(chips.length).toBe(1); | ||
| }); | ||
|
|
||
| it("should append unknown tag to top of list", async () => { | ||
|
||
| const page = await newE2EPage(); | ||
| await page.setContent(html` | ||
| <calcite-combobox allow-custom-values selection-mode="single"> | ||
| <calcite-combobox-item id="two" value="two" text-label="two"></calcite-combobox-item> | ||
| <calcite-combobox-item id="three" value="three" text-label="three"></calcite-combobox-item> | ||
| </calcite-combobox> | ||
| `); | ||
| const input = await page.find("calcite-combobox >>> input"); | ||
|
|
||
| await input.click(); | ||
| await page.keyboard.type("one"); | ||
| await input.press("Enter"); | ||
| await page.waitForChanges(); | ||
|
|
||
| const firstItem = await page.find("calcite-combobox-item:first-child"); | ||
| expect(await firstItem.getProperty("textLabel")).toBe("one"); | ||
|
|
||
| const lastItem = await page.find("calcite-combobox-item:last-child"); | ||
| expect(await lastItem.getProperty("textLabel")).toBe("three"); | ||
| }); | ||
|
|
||
| it("should fire calciteComboboxChange when entering new unknown tag", async () => { | ||
| const page = await newE2EPage(); | ||
| await page.setContent(html` | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the move of the
selectedattribute affect the test? If so, there might be an issue. If not, let's restore it. Applies to similarly updated tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I restored the
selectedprops.