Skip to content

Commit

Permalink
fix: logic for collapse-on-select was backwards (#2315)
Browse files Browse the repository at this point in the history
=
  • Loading branch information
LuLaValva authored Nov 1, 2024
1 parent eff515a commit d53c7f6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/hungry-stingrays-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ebay/ebayui-core": patch
---

Fix collapseOnSelect
2 changes: 1 addition & 1 deletion src/components/ebay-listbox-button/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ListboxButton extends Marko.Component<Input, State> {
}

handleListboxChange(event: ChangeEvent) {
if (this.input.collapseOnSelect === false) {
if (this.input.collapseOnSelect !== false) {
this._expander.expanded = false;
}
const selectedIndex = event.index;
Expand Down
7 changes: 7 additions & 0 deletions src/components/ebay-listbox-button/test/test.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ describe("given the listbox is in an expanded state", () => {
.has.property("selected")
.and.is.deep.equal([options[1].value]);
});

it("then it has collapsed the listbox", () => {
expect(component.getByRole("button")).toHaveAttribute(
"aria-expanded",
"false",
);
});
});

describe("when the down arrow key is pressed", () => {
Expand Down

0 comments on commit d53c7f6

Please sign in to comment.