Skip to content

Commit 4c25589

Browse files
committed
more uui-icon tests
1 parent 6c335b1 commit 4c25589

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

packages/uui-icon/lib/uui-icon.test.ts

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import '.';
44

55
import { iconRegistry } from './UUIIconRegistry';
66

7-
describe('UUIIconElement', () => {
8-
const TEST_SVG =
9-
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"></svg>';
7+
const TEST_SVG =
8+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"></svg>';
9+
iconRegistry.defineIcon('test', TEST_SVG);
10+
11+
describe('UUIIconElement with name', () => {
1012
let element: UUIIconElement;
1113

1214
beforeEach(async () => {
13-
iconRegistry.defineIcon('test', TEST_SVG);
1415
element = await fixture(html` <uui-icon name="test"></uui-icon> `);
1516
});
1617

@@ -22,3 +23,37 @@ describe('UUIIconElement', () => {
2223
await expect(element).shadowDom.to.be.accessible();
2324
});
2425
});
26+
27+
describe('UUIIconElement with svg', () => {
28+
let element: UUIIconElement;
29+
30+
beforeEach(async () => {
31+
element = await fixture(html` <uui-icon svg=${TEST_SVG}></uui-icon> `);
32+
});
33+
34+
it('contains svg of icon', async () => {
35+
await expect(element).shadowDom.to.equal(TEST_SVG);
36+
});
37+
38+
it('passes the a11y audit', async () => {
39+
await expect(element).shadowDom.to.be.accessible();
40+
});
41+
});
42+
43+
describe('UUIIconElement with fallback', () => {
44+
let element: UUIIconElement;
45+
46+
beforeEach(async () => {
47+
element = await fixture(
48+
html` <uui-icon name="not_existing" fallback=${TEST_SVG}></uui-icon> `
49+
);
50+
});
51+
52+
it('contains svg of icon', async () => {
53+
await expect(element).shadowDom.to.equal(TEST_SVG);
54+
});
55+
56+
it('passes the a11y audit', async () => {
57+
await expect(element).shadowDom.to.be.accessible();
58+
});
59+
});

0 commit comments

Comments
 (0)