diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d4bec76..0f1abbb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/scripts/choices.ts b/src/scripts/choices.ts index f8fd1052..d3c5fa00 100644 --- a/src/scripts/choices.ts +++ b/src/scripts/choices.ts @@ -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; diff --git a/test/scripts/choices.test.ts b/test/scripts/choices.test.ts index e7f365af..de409714 100644 --- a/test/scripts/choices.test.ts +++ b/test/scripts/choices.test.ts @@ -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, @@ -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,