@@ -4,13 +4,14 @@ import '.';
4
4
5
5
import { iconRegistry } from './UUIIconRegistry' ;
6
6
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' , ( ) => {
10
12
let element : UUIIconElement ;
11
13
12
14
beforeEach ( async ( ) => {
13
- iconRegistry . defineIcon ( 'test' , TEST_SVG ) ;
14
15
element = await fixture ( html ` < uui-icon name ="test "> </ uui-icon > ` ) ;
15
16
} ) ;
16
17
@@ -22,3 +23,37 @@ describe('UUIIconElement', () => {
22
23
await expect ( element ) . shadowDom . to . be . accessible ( ) ;
23
24
} ) ;
24
25
} ) ;
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