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

Combobox does not reset modelValue and textbox value on reset #2116

Open
Knorgias opened this issue Nov 2, 2023 · 0 comments
Open

Combobox does not reset modelValue and textbox value on reset #2116

Knorgias opened this issue Nov 2, 2023 · 0 comments

Comments

@Knorgias
Copy link
Collaborator

Knorgias commented Nov 2, 2023

Expected behavior

Combobox resets modelValue and textbox value on reset

Actual Behavior

Combobox does not reset modelValue and textbox value on reset

Additional context

lion-combobox, latest

The failing test:

it('resets modelValue and textbox value on reset()', async () => {
      const el = /** @type {LionCombobox} */ (
        await fixture(html`
          <lion-combobox name="foo" .modelValue="${0}">
            <lion-option .choiceValue="${0}">Artichoke</lion-option>
            <lion-option .choiceValue="${1}">Chard</lion-option>
            <lion-option .choiceValue="${2}">Chicory</lion-option>
            <lion-option .choiceValue="${3}">Victoria Plum</lion-option>
          </lion-combobox>
        `)
      );

      const { _inputNode } = getComboboxMembers(el);
      el.modelValue = 1;
      el.reset();
      expect(el.modelValue).to.equal(0);
      expect(_inputNode.value).to.equal('Artichoke');

      const el2 = /** @type {LionCombobox} */ (
        await fixture(html`
          <lion-combobox name="foo" multiple-choice .modelValue="${[0]}">
            <lion-option .choiceValue="${0}">Artichoke</lion-option>
            <lion-option .choiceValue="${1}">Chard</lion-option>
            <lion-option .choiceValue="${2}">Chicory</lion-option>
            <lion-option .choiceValue="${3}">Victoria Plum</lion-option>
          </lion-combobox>
        `)
      );
      el2.modelValue = [0, 1];
      el2.reset();
      expect(el2.modelValue).to.deep.equal([0]);
      // @ts-ignore [allow-protected] in test
      expect(el2._inputNode.value).to.equal('Artichoke');
    });
    ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant