Skip to content

Commit

Permalink
feat(checkbox): dispatch input event
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 549682970
  • Loading branch information
asyncLiz authored and copybara-github committed Jul 20, 2023
1 parent 921f185 commit 154861c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions checkbox/lib/checkbox_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ describe('checkbox', () => {
expect(changeHandler).toHaveBeenCalledTimes(1);
expect(changeHandler).toHaveBeenCalledWith(jasmine.any(Event));
});

it('should trigger input event when checkbox is selected', async () => {
const {harness} = await setupTest();
const inputHandler = jasmine.createSpy('inputHandler');
harness.element.addEventListener('input', inputHandler);

await harness.clickWithMouse();

expect(harness.element.checked).toBeTrue();
expect(inputHandler).toHaveBeenCalledTimes(1);
expect(inputHandler).toHaveBeenCalledWith(jasmine.any(Event));
});
});

describe('checked', () => {
Expand Down

0 comments on commit 154861c

Please sign in to comment.