feat(catalog): add anchor IDs to featured groups
This commit is contained in:
@@ -155,6 +155,7 @@ export type CatalogFeaturedItems =
|
|||||||
|
|
||||||
export interface CatalogFeaturedGroup {
|
export interface CatalogFeaturedGroup {
|
||||||
id: number;
|
id: number;
|
||||||
|
code: string;
|
||||||
title: string;
|
title: string;
|
||||||
layout: CatalogProductLayout;
|
layout: CatalogProductLayout;
|
||||||
group_layout: CatalogGroupLayout;
|
group_layout: CatalogGroupLayout;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</p>
|
</p>
|
||||||
} @else {
|
} @else {
|
||||||
@for (group of catalog(); track group.id) {
|
@for (group of catalog(); track group.id) {
|
||||||
<app-store-section [title]="group.title">
|
<app-store-section [attr.id]="group.code" [title]="group.title">
|
||||||
<app-product-list
|
<app-product-list
|
||||||
[layout]="group.layout"
|
[layout]="group.layout"
|
||||||
[groupLayout]="group.group_layout"
|
[groupLayout]="group.group_layout"
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ app-store-section + app-store-section {
|
|||||||
margin-top: clamp(3rem, 6vw, 5rem);
|
margin-top: clamp(3rem, 6vw, 5rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app-store-section[id] {
|
||||||
|
scroll-margin-top: 8rem;
|
||||||
|
}
|
||||||
|
|
||||||
:host > .store-home__additional-info:not(:first-child) {
|
:host > .store-home__additional-info:not(:first-child) {
|
||||||
margin-top: clamp(3rem, 6vw, 5rem);
|
margin-top: clamp(3rem, 6vw, 5rem);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ function createCatalog(
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
id: 7,
|
id: 7,
|
||||||
|
code: 'destacados',
|
||||||
title: 'Destacados',
|
title: 'Destacados',
|
||||||
layout: 'column_with_image',
|
layout: 'column_with_image',
|
||||||
group_layout: 'paginated',
|
group_layout: 'paginated',
|
||||||
@@ -149,6 +150,7 @@ describe('StoreHomePageComponent', () => {
|
|||||||
const element = fixture.nativeElement as HTMLElement;
|
const element = fixture.nativeElement as HTMLElement;
|
||||||
|
|
||||||
expect(catalogServiceStub.getCatalog).not.toHaveBeenCalled();
|
expect(catalogServiceStub.getCatalog).not.toHaveBeenCalled();
|
||||||
|
expect(element.querySelector('app-store-section')?.id).toBe('destacados');
|
||||||
expect(element.querySelector('.store-section__title')?.textContent?.trim()).toBe('Destacados');
|
expect(element.querySelector('.store-section__title')?.textContent?.trim()).toBe('Destacados');
|
||||||
expect(element.querySelectorAll('app-product-column-with-image')).toHaveLength(2);
|
expect(element.querySelectorAll('app-product-column-with-image')).toHaveLength(2);
|
||||||
expect(element.textContent).toContain('Auriculares Bluetooth');
|
expect(element.textContent).toContain('Auriculares Bluetooth');
|
||||||
|
|||||||
Reference in New Issue
Block a user