From 3dc92ae8e826a3f8098380127227b60b8faba15c Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Fri, 3 Dec 2021 15:04:26 -0500 Subject: [PATCH] fix switch tests --- src/components/switch/switch.test.ts | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/components/switch/switch.test.ts b/src/components/switch/switch.test.ts index faaad61ca..faeff181e 100644 --- a/src/components/switch/switch.test.ts +++ b/src/components/switch/switch.test.ts @@ -35,16 +35,23 @@ describe('', () => { expect(el.checked).to.be.true; }); - // TODO - arrow key doesn't seem to be sending - // TODO - test for left arrow too - // it('should fire sl-change when toggled with the right arrow', async () => { - // const el = await fixture(html` `); - // el.focus(); - // setTimeout(() => sendKeys({ press: 'ArrowRight' })); - // const event = await oneEvent(el, 'sl-change'); - // expect(event.target).to.equal(el); - // expect(el.checked).to.be.true; - // }); + it('should fire sl-change when toggled with the right arrow', async () => { + const el = await fixture(html` `); + el.focus(); + setTimeout(() => sendKeys({ press: 'ArrowRight' })); + const event = await oneEvent(el, 'sl-change'); + expect(event.target).to.equal(el); + expect(el.checked).to.be.true; + }); + + it('should fire sl-change when toggled with the left arrow', async () => { + const el = await fixture(html` `); + el.focus(); + setTimeout(() => sendKeys({ press: 'ArrowLeft' })); + const event = await oneEvent(el, 'sl-change'); + expect(event.target).to.equal(el); + expect(el.checked).to.be.false; + }); it('should not fire sl-change when checked is set by javascript', async () => { const el = await fixture(html` `);