Skip to content
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

Fix regression of UnhighlightItem event not firing (#1173) #1194

Merged
merged 2 commits into from
Sep 4, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Fix choice disable state wasn't considered when showing the "no choices to choose from" notice
* Fix regression "no choices to choose from" notice not triggering when no selectable choices exist for select-one. [#1185](https://github.com/Choices-js/Choices/issues/1185)
* Fix regression where webpack doesn't permit importing scss/css @tagliala (#1193)
* Fix regression of UnhighlightItem event not firing [#1173](https://github.com/Choices-js/Choices/issues/1173)

### Chore
* Add e2e tests for "no choices" behavior to match v10
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/choices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ class Choices {
this._store.dispatch(highlightItem(choice, false));

if (runEvent) {
this.passedElement.triggerEvent(EventType.highlightItem, this._getChoiceForOutput(choice));
this.passedElement.triggerEvent(EventType.unhighlightItem, this._getChoiceForOutput(choice));
}

return this;
Expand Down
4 changes: 2 additions & 2 deletions test/scripts/choices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ describe('choices', () => {

it('triggers event with null groupValue', () => {
expect(passedElementTriggerEventStub.called).to.equal(true);
expect(passedElementTriggerEventStub.lastCall.args[0]).to.equal(EventType.highlightItem);
expect(passedElementTriggerEventStub.lastCall.args[0]).to.equal(EventType.unhighlightItem);
expect(passedElementTriggerEventStub.lastCall.args[1]).to.contains({
value: item.value,
label: item.label,
Expand All @@ -983,7 +983,7 @@ describe('choices', () => {

it('triggers event with groupValue', () => {
expect(passedElementTriggerEventStub.called).to.equal(true);
expect(passedElementTriggerEventStub.lastCall.args[0]).to.equal(EventType.highlightItem);
expect(passedElementTriggerEventStub.lastCall.args[0]).to.equal(EventType.unhighlightItem);
expect(passedElementTriggerEventStub.lastCall.args[1]).to.contains({
value: item.value,
label: item.label,
Expand Down
Loading