diff --git a/addon/components/listbox/-button.hbs b/addon/components/listbox/-button.hbs index e485fba0..eef1ee2b 100644 --- a/addon/components/listbox/-button.hbs +++ b/addon/components/listbox/-button.hbs @@ -1,6 +1,7 @@ {{#let (element (or @as 'button')) as |Tag|}} ', function (hooks) { assertNoActiveListboxOption(); }); }); + + test('should be possible to open a listbox without submitting the form', async function (assert) { + let callCount = 0; + + this.set('onSubmit', () => { + callCount++; + }); + + await render(hbs` +
+ + Trigger + + option + + +
+ `); + assertListboxButton({ + state: ListboxState.InvisibleUnmounted, + }); + assertListbox({ + state: ListboxState.InvisibleUnmounted, + }); + await click(getListboxButton()); + assertListbox({ state: ListboxState.Visible }); + + assert.equal(callCount, 0, 'onSubmit not called'); + }); });