Skip to content

Commit

Permalink
feat: make form pickup combobox input
Browse files Browse the repository at this point in the history
  • Loading branch information
DukeFerdinand committed Feb 5, 2025
1 parent 2f72124 commit 47aa6fe
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/form/src/auro-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export class AuroForm extends LitElement {
'auro-input',
'auro-select',
'auro-datepicker',
'auro-combobox',
// checkbox and radio are grouped elements
'auro-checkbox-group',
'auro-radio-group',
Expand Down
30 changes: 30 additions & 0 deletions components/form/test/auro-form-interactions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,34 @@ describe('auro-form', () => {
await expect(form.value.testGroup).to.equal('yes');
});
});

describe('when an auro-combobox is present', () => {
const componentTemplate = html`
<auro-form>
<auro-combobox name="comboTest">
<span slot="label">Name</span>
<auro-menu>
<auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
<auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
<auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
<auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
<auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
<auro-menuoption static nomatch>No matching option</auro-menuoption>
</auro-menu>
</auro-combobox>
</auro-form>
`;

useSharedTestBehavior('auro-combobox', componentTemplate);

it('should store combobox value as a string array', async () => {
const form = await fixture(componentTemplate);
const [combobox] = form._elements;

combobox.input.value = 'Oranges';

await elementUpdated(form);
await expect(form.value.comboTest).to.deep.equal(['Oranges']);
});
});
});

0 comments on commit 47aa6fe

Please sign in to comment.