From 4ba66ad2155c51e1138b64c2089f22e7a82a294e Mon Sep 17 00:00:00 2001 From: LuLaValva Date: Fri, 1 Nov 2024 14:53:36 -0700 Subject: [PATCH 1/3] fix: logic for collapse-on-select was backwards --- src/components/ebay-listbox-button/component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ebay-listbox-button/component.ts b/src/components/ebay-listbox-button/component.ts index 261896cb4..560c78b48 100644 --- a/src/components/ebay-listbox-button/component.ts +++ b/src/components/ebay-listbox-button/component.ts @@ -52,7 +52,7 @@ class ListboxButton extends Marko.Component { } handleListboxChange(event: ChangeEvent) { - if (this.input.collapseOnSelect === false) { + if (this.input.collapseOnSelect !== false) { this._expander.expanded = false; } const selectedIndex = event.index; From 3081eb70bda444b38cb6c23c102b6236fda26265 Mon Sep 17 00:00:00 2001 From: LuLaValva Date: Fri, 1 Nov 2024 14:58:36 -0700 Subject: [PATCH 2/3] chore: add changeset --- .changeset/hungry-stingrays-chew.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/hungry-stingrays-chew.md diff --git a/.changeset/hungry-stingrays-chew.md b/.changeset/hungry-stingrays-chew.md new file mode 100644 index 000000000..85e598388 --- /dev/null +++ b/.changeset/hungry-stingrays-chew.md @@ -0,0 +1,5 @@ +--- +"@ebay/ebayui-core": patch +--- + +Fix collapseOnSelect From b7c311908b1d6461faa01af5e9e3912181281221 Mon Sep 17 00:00:00 2001 From: LuLaValva Date: Fri, 1 Nov 2024 15:07:06 -0700 Subject: [PATCH 3/3] test: collapseOnSelect --- src/components/ebay-listbox-button/test/test.browser.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/ebay-listbox-button/test/test.browser.js b/src/components/ebay-listbox-button/test/test.browser.js index d32eb09c5..33c3ffbbb 100644 --- a/src/components/ebay-listbox-button/test/test.browser.js +++ b/src/components/ebay-listbox-button/test/test.browser.js @@ -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", () => {