diff --git a/test-app/tests/integration/components/combobox-test.js b/test-app/tests/integration/components/combobox-test.js index a3d59356..3bc2378f 100644 --- a/test-app/tests/integration/components/combobox-test.js +++ b/test-app/tests/integration/components/combobox-test.js @@ -236,6 +236,54 @@ module('Integration | Component | ', function (hooks) { assert.dom(getComboboxInput()).hasValue('B'); }); + + test('selecting an option puts the display value into Combobox.Input when displayValue is provided and values are objects', async function (assert) { + this.set('onChange', (value) => { + this.set('value', value); + }); + + this.setProperties({ + value: null, + a: { value: 'a' }, + b: { value: 'b' }, + c: { value: 'c' }, + displayValue: (option) => { + return option?.value?.toUpperCase() || 'None'; + }, + }); + + await render(hbs` + + + Trigger + + Option A + Option B + Option C + + + `); + + await click(getComboboxButton()); + assertComboboxList({ state: ComboboxState.Visible }); + + await click(getComboboxOptions()[1]); + assert.dom(getComboboxInput()).hasValue('B'); + + await click(getComboboxButton()); + assertComboboxList({ state: ComboboxState.Visible }); + + assert.dom(getComboboxInput()).hasValue('B'); + + await click(document.body); + assertComboboxList({ state: ComboboxState.InvisibleUnmounted }); + + assert.dom(getComboboxInput()).hasValue('B'); + }); }); module('Combobox.Label', () => {