slCheckbox - add additional tests for checked property

This commit is contained in:
Chris Haynes
2020-08-28 23:11:30 +01:00
parent 0bd7a1b2b4
commit 7c82d46576

View File

@@ -110,4 +110,32 @@ describe('checkbox', () => {
expect(slChange).toHaveReceivedEventTimes(1);
});
it('should emit slChange when state changes when checked property set to true', async () => {
const page = await newE2EPage();
await page.setContent(testContentUnchecked);
const checkbox = await page.find('sl-checkbox');
const slChange = await checkbox.spyOnEvent('slChange');
checkbox.setProperty('checked', true);
await page.waitForChanges();
expect(slChange).toHaveReceivedEventTimes(1);
});
it('should emit slChange when state changes when checked property set to false', async () => {
const page = await newE2EPage();
await page.setContent(testContentChecked);
const checkbox = await page.find('sl-checkbox');
const slChange = await checkbox.spyOnEvent('slChange');
checkbox.setProperty('checked', false);
await page.waitForChanges();
expect(slChange).toHaveReceivedEventTimes(1);
});
});