diff --git a/src/components/icon/icon.test.ts b/src/components/icon/icon.test.ts index 91d92fbf5..fb825f91a 100644 --- a/src/components/icon/icon.test.ts +++ b/src/components/icon/icon.test.ts @@ -1,17 +1,20 @@ /* eslint-disable no-restricted-imports */ -import { elementUpdated, expect, fixture, html, oneEvent } from '@open-wc/testing'; -// import sinon from 'sinon'; -/* @ts-expect-error - Need to switch to path aliases when Web Test Runner's esbuild plugin allows it */ +import { elementUpdated, expect, fixture, html, oneEvent, waitUntil } from '@open-wc/testing'; +/* @ts-expect-error - TODO - switch to path aliases when Web Test Runner's esbuild plugin allows it */ import { registerIconLibrary } from '../../../dist/shoelace.js'; import type SlIcon from './icon'; const testLibraryIcons = { - 'test-icon1': ` - - `, - 'test-icon2': ` - - `, + 'test-icon1': ` + + + + `, + 'test-icon2': ` + + + + `, 'bad-icon': `
` }; @@ -82,7 +85,7 @@ describe('', () => { }); }); - describe('whena valid src is provided', () => { + describe('when a valid src is provided', () => { it('the svg is rendered', async () => { const fakeId = 'test-src'; const el = await fixture(html` `); @@ -111,7 +114,7 @@ describe('', () => { expect(ev.isTrusted).to.exist; }); - it('runs mutators from new library', async () => { + it('runs mutator from new library', async () => { const el = await fixture(html` `); await elementUpdated(el); @@ -122,8 +125,8 @@ describe('', () => { describe('negative cases', () => { // using new library so we can test for malformed icons when registered - it('svg not rendered with an icon that doesnt exist in the library', async () => { - const el = await fixture(html` `); + it("svg not rendered with an icon that doesn't exist in the library", async () => { + const el = await fixture(html` `); expect(el.shadowRoot?.querySelector('svg')).to.be.null; }); @@ -140,7 +143,7 @@ describe('', () => { expect(ev).to.exist; }); - it('emits sl-error when there isnt an svg element in the registered icon', async () => { + it("emits sl-error when there isn't an svg element in the registered icon", async () => { const el = await fixture(html` `); const listener = oneEvent(el, 'sl-error'); @@ -152,28 +155,4 @@ describe('', () => { expect(ev).to.exist; }); }); - - // describe('cached icon request timing', () => { - // it('sl-load event doesnt fire until after firstUpdated, even when the icon is cached', async () => { - // // have to use an icon not used in tests before - // // div in fixture so we can append another icon - // const el = await fixture(html`
`); - - // const newIcon = document.createElement('sl-icon'); - // newIcon.library = 'system'; - // newIcon.name = 'chevron-down'; - - // let updateCount: number; - // newIcon.updateComplete.then(() => { - // updateCount = updateCount++; - // }); - - // newIcon.addEventListener('sl-load', () => { - // expect(updateCount).to.equal(1); - // }); - - // el.append(newIcon); - - // }); - // }); });