feat(hero-banner): update image handling to support responsive images and refactor template
feat(cart): enhance editing logic and add tests for editable state feat(tenant): modify HeroConfig to include responsive image type
This commit is contained in:
@@ -2,6 +2,28 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { HeroBannerComponent } from './hero-banner.component';
|
||||
|
||||
describe('HeroBannerComponent', () => {
|
||||
it('renders desktop and mobile crop variants', async () => {
|
||||
await TestBed.configureTestingModule({ imports: [HeroBannerComponent] }).compileComponents();
|
||||
|
||||
const fixture = TestBed.createComponent(HeroBannerComponent);
|
||||
fixture.componentRef.setInput('heroConfig', {
|
||||
background_image_id: {
|
||||
desktop: 'https://example.com/desktop.jpg',
|
||||
mobile: 'https://example.com/mobile.jpg',
|
||||
},
|
||||
});
|
||||
fixture.detectChanges();
|
||||
|
||||
const element = fixture.nativeElement as HTMLElement;
|
||||
|
||||
expect(element.querySelector('source')?.getAttribute('srcset')).toBe(
|
||||
'https://example.com/mobile.jpg',
|
||||
);
|
||||
expect(element.querySelector('img')?.getAttribute('src')).toBe(
|
||||
'https://example.com/desktop.jpg',
|
||||
);
|
||||
});
|
||||
|
||||
it('expands and collapses the event schedules', async () => {
|
||||
await TestBed.configureTestingModule({ imports: [HeroBannerComponent] }).compileComponents();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user