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

Fix/user input changed listbox #1971

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/little-lies-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lion/ui': patch
---

[listbox] add user-input-changed event
1 change: 1 addition & 0 deletions packages/ui/components/listbox/src/ListboxMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ const ListboxMixinImplementation = superclass =>
_onChildActiveChanged({ target }) {
if (target.active === true) {
this.__setChildActive(target);
this.dispatchEvent(new Event('user-input-changed', { bubbles: true }));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ export function runListboxMixinSuite(customConfig = {}) {
expect(spy.callCount).to.equal(1);
});

it('should dispatch user-input-changed event on child active change', async () => {
const spy = sinon.spy();
const el = await fixture(html`
<${tag}>
<${optionTag} .choiceValue="${'10'}">Item 1</${optionTag}>
<${optionTag} .choiceValue="${'20'}">Item 2</${optionTag}>
<${optionTag} .choiceValue="${'30'}">Item 3</${optionTag}>
</${tag}>
`);

el.addEventListener('user-input-changed', spy);
expect(spy.callCount).to.equal(0);
el.formElements[2].active = true;
expect(spy.callCount).to.equal(1);
});

it('automatically sets the name attribute of child checkboxes to its own name', async () => {
const el = await fixture(html`
<${tag} name="foo">
Expand Down