diff --git a/angular/projects/spark-angular/src/lib/components/sprk-footer/sprk-footer.component.spec.ts b/angular/projects/spark-angular/src/lib/components/sprk-footer/sprk-footer.component.spec.ts index 2c7d09a0ae..cdc1e14907 100644 --- a/angular/projects/spark-angular/src/lib/components/sprk-footer/sprk-footer.component.spec.ts +++ b/angular/projects/spark-angular/src/lib/components/sprk-footer/sprk-footer.component.spec.ts @@ -58,4 +58,111 @@ describe('SprkFooterComponent', () => { fixture.detectChanges(); expect(element.getAttribute('data-id')).toBeNull(); }); + + it('should set the href link of the localLinks', () => { + component.localLinks = [ + { heading: 'Site Links', links: [{ text: 'Item 1', href: '/alert' }] }, + ]; + fixture.detectChanges(); + const localLink = fixture.nativeElement.querySelector( + '.sprk-c-Footer__link', + ); + expect(localLink.getAttribute('href')).toEqual('/alert'); + }); + + it('should set the href link of the localLinks when using routerLink', () => { + component.localLinks = [ + { + heading: 'Site Links', + links: [{ text: 'Item 1', routerLink: '/alert-router' }], + }, + ]; + fixture.detectChanges(); + const localLink = fixture.nativeElement.querySelector( + '.sprk-c-Footer__link', + ); + expect(localLink.getAttribute('href')).toEqual('/alert-router'); + }); + + it('should set the href link of the globalLinks', () => { + component.globalLinks = [ + { + text: 'Test Text', + href: '/alert', + imgSrc: 'https://spark-assets.netlify.app/rocket-by-ql-white.svg', + imgAlt: 'Rocket Mortgage by Quicken Loans Logo', + }, + ]; + fixture.detectChanges(); + const globalLink = fixture.nativeElement.querySelector('.sprk-b-Link'); + expect(globalLink.getAttribute('href')).toEqual('/alert'); + }); + + it('should set the href link of the globalLinks when using routerLink', () => { + component.globalLinks = [ + { + text: 'Test Text', + routerLink: '/alert-router', + imgSrc: 'https://spark-assets.netlify.app/rocket-by-ql-white.svg', + imgAlt: 'Rocket Mortgage by Quicken Loans Logo', + }, + ]; + fixture.detectChanges(); + const globalLink = fixture.nativeElement.querySelector('.sprk-b-Link'); + expect(globalLink.getAttribute('href')).toEqual('/alert-router'); + }); + + it('should set the href link of the socialLinks', () => { + component.socialLinks = [{ href: '/alert', icon: 'facebook' }]; + fixture.detectChanges(); + const socialLink = fixture.nativeElement.querySelector('.sprk-b-Link'); + expect(socialLink.getAttribute('href')).toEqual('/alert'); + }); + + it('should set the href link of the socialLinks when using routerLink', () => { + component.socialLinks = [{ routerLink: '/alert-router', icon: 'facebook' }]; + fixture.detectChanges(); + const socialLink = fixture.nativeElement.querySelector('.sprk-b-Link'); + expect(socialLink.getAttribute('href')).toEqual('/alert-router'); + }); + + it('should set the href link of the badgeLinks', () => { + component.badgeLinks = [{ href: '/alert', icon: 'townhouse' }]; + fixture.detectChanges(); + const badgeLink = fixture.nativeElement.querySelector('.sprk-b-Link'); + expect(badgeLink.getAttribute('href')).toEqual('/alert'); + }); + + it('should set the href link of the badgeLinks when using routerLink', () => { + component.badgeLinks = [{ routerLink: '/alert-router', icon: 'townhouse' }]; + fixture.detectChanges(); + const badgeLink = fixture.nativeElement.querySelector('.sprk-b-Link'); + expect(badgeLink.getAttribute('href')).toEqual('/alert-router'); + }); + + it('should set the href link of the awards', () => { + component.awards = [ + { + href: '/alert', + imgSrc: 'https://spark-assets.netlify.app/spark-logo-mark.svg', + imgAlt: 'placeholder', + }, + ]; + fixture.detectChanges(); + const award = fixture.nativeElement.querySelector('.sprk-b-Link'); + expect(award.getAttribute('href')).toEqual('/alert'); + }); + + it('should set the href link of the awards when using routerLink', () => { + component.awards = [ + { + routerLink: '/alert-router', + imgSrc: 'https://spark-assets.netlify.app/spark-logo-mark.svg', + imgAlt: 'placeholder', + }, + ]; + fixture.detectChanges(); + const award = fixture.nativeElement.querySelector('.sprk-b-Link'); + expect(award.getAttribute('href')).toEqual('/alert-router'); + }); }); diff --git a/angular/projects/spark-angular/src/lib/components/sprk-footer/sprk-footer.interfaces.ts b/angular/projects/spark-angular/src/lib/components/sprk-footer/sprk-footer.interfaces.ts index cf56197ed6..39031b9b80 100644 --- a/angular/projects/spark-angular/src/lib/components/sprk-footer/sprk-footer.interfaces.ts +++ b/angular/projects/spark-angular/src/lib/components/sprk-footer/sprk-footer.interfaces.ts @@ -180,7 +180,7 @@ export interface ISprkFooterGlobalLink { /** * Name of the icon. */ - icon: string; + icon?: string; /** * Expects a space separated string * of classes to be added to the