Skip to content

Commit b61180e

Browse files
fix: add tests
1 parent 990f802 commit b61180e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
import { createHostFactory, Spectator } from '@ngneat/spectator/jest';
2+
import { MockComponent } from 'ng-mocks';
3+
import { IconComponent } from '../icon/icon.component';
24
import { LabelTagComponent } from './label-tag.component';
35

46
describe('Label Tag Component', () => {
57
let spectator: Spectator<LabelTagComponent>;
68

79
const createHost = createHostFactory({
810
component: LabelTagComponent,
9-
shallow: true
11+
shallow: true,
12+
declarations: [MockComponent(IconComponent)]
1013
});
1114

1215
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+
);
1419
const labelElement = spectator.query('.label-tag') as HTMLElement;
1520
expect(labelElement).toHaveText('Beta');
1621
expect(labelElement.style.backgroundColor).toEqual('rgb(242, 208, 245)');
1722
expect(labelElement.style.color).toEqual('rgb(148, 32, 159)');
23+
expect(spectator.query(IconComponent)?.icon).toBe('test-icon');
1824
});
1925
});

0 commit comments

Comments
 (0)