-
Notifications
You must be signed in to change notification settings - Fork 79
/
cms-image.component.spec.ts
51 lines (45 loc) · 1.59 KB
/
cms-image.component.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core';
import { createContentPageletView } from 'ish-core/models/content-view/content-view.model';
import { CMSImageComponent } from './cms-image.component';
describe('Cms Image Component', () => {
let component: CMSImageComponent;
let fixture: ComponentFixture<CMSImageComponent>;
let element: HTMLElement;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [TranslateModule.forRoot()],
declarations: [CMSImageComponent],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(CMSImageComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
const pagelet = {
definitionQualifiedName: 'fq',
id: 'id',
displayName: 'name',
domain: 'domain',
configurationParameters: {
Image: 'http://example.com/foo/bar.png',
AlternateText: 'foo',
CSSClass: 'foo',
Link: 'http://example.com',
LinkTitle: 'bar',
},
};
component.pagelet = createContentPageletView(pagelet);
});
it('should be created', () => {
expect(component).toBeTruthy();
expect(element).toBeTruthy();
expect(() => fixture.detectChanges()).not.toThrow();
expect(element).toMatchInlineSnapshot(`
<a class="teaser-link" href="http://example.com" title="bar"
><div ng-reflect-ng-class="foo" class="foo">
<img loading="lazy" src="http://example.com/foo/bar.png" alt="foo" /></div
></a>
`);
});
});