File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
projects/components/src/label-tag Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { createHostFactory , Spectator } from '@ngneat/spectator/jest' ;
2
+ import { MockComponent } from 'ng-mocks' ;
3
+ import { IconComponent } from '../icon/icon.component' ;
2
4
import { LabelTagComponent } from './label-tag.component' ;
3
5
4
6
describe ( 'Label Tag Component' , ( ) => {
5
7
let spectator : Spectator < LabelTagComponent > ;
6
8
7
9
const createHost = createHostFactory ( {
8
10
component : LabelTagComponent ,
9
- shallow : true
11
+ shallow : true ,
12
+ declarations : [ MockComponent ( IconComponent ) ]
10
13
} ) ;
11
14
12
15
test ( 'renders the beta tag with given parameters' , ( ) => {
13
- spectator = createHost ( '<ht-label-tag label="Beta" backgroundColor="#f2d0f5" labelColor="#94209f"></ht-label-tag>' ) ;
16
+ spectator = createHost (
17
+ '<ht-label-tag label="Beta" backgroundColor="#f2d0f5" labelColor="#94209f" prefixIcon="test-icon"></ht-label-tag>'
18
+ ) ;
14
19
const labelElement = spectator . query ( '.label-tag' ) as HTMLElement ;
15
20
expect ( labelElement ) . toHaveText ( 'Beta' ) ;
16
21
expect ( labelElement . style . backgroundColor ) . toEqual ( 'rgb(242, 208, 245)' ) ;
17
22
expect ( labelElement . style . color ) . toEqual ( 'rgb(148, 32, 159)' ) ;
23
+ expect ( spectator . query ( IconComponent ) ?. icon ) . toBe ( 'test-icon' ) ;
18
24
} ) ;
19
25
} ) ;
You can’t perform that action at this time.
0 commit comments