21 lines
690 B
TypeScript
21 lines
690 B
TypeScript
import { TestBed } from '@angular/core/testing';
|
|
|
|
import { ProductImage } from './product-image';
|
|
|
|
describe('ProductImage', () => {
|
|
beforeEach(() => {
|
|
TestBed.configureTestingModule({ imports: [ProductImage] });
|
|
});
|
|
|
|
it('it renders the image with proper src and alt', () => {
|
|
const fixture = TestBed.createComponent(ProductImage);
|
|
fixture.componentRef.setInput('imgUrl', 'https://example.com/a.jpg');
|
|
fixture.componentRef.setInput('alt', 'Acer Iconia');
|
|
fixture.detectChanges();
|
|
|
|
const img: HTMLImageElement = fixture.nativeElement.querySelector('img');
|
|
expect(img.src).toBe('https://example.com/a.jpg');
|
|
expect(img.alt).toBe('Acer Iconia');
|
|
});
|
|
});
|