Skip to content

Commit

Permalink
Merge pull request #3841 from sparkdesignsystem/link-katie
Browse files Browse the repository at this point in the history
add footer tests
  • Loading branch information
Amber Febbraro authored Feb 4, 2021
2 parents dc09aaf + 186d663 commit 677c2b9
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 677c2b9

Please sign in to comment.