From 154861c99e51e22c0a96f29fe5be22e053bbe04f Mon Sep 17 00:00:00 2001 From: Elizabeth Mitchell Date: Thu, 20 Jul 2023 11:04:55 -0700 Subject: [PATCH] feat(checkbox): dispatch input event PiperOrigin-RevId: 549682970 --- checkbox/lib/checkbox_test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/checkbox/lib/checkbox_test.ts b/checkbox/lib/checkbox_test.ts index 690ec52cdf..43afdf5991 100644 --- a/checkbox/lib/checkbox_test.ts +++ b/checkbox/lib/checkbox_test.ts @@ -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', () => {