From fd82f52ea4c662730fca6bccab13a2b2260c2d6b Mon Sep 17 00:00:00 2001 From: Febbraro Date: Thu, 4 Feb 2021 13:38:04 -0700 Subject: [PATCH] add card tests --- .../sprk-card/sprk-card.component.spec.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/angular/projects/spark-angular/src/lib/components/sprk-card/sprk-card.component.spec.ts b/angular/projects/spark-angular/src/lib/components/sprk-card/sprk-card.component.spec.ts index eca183c57c..6a6f5fb80f 100644 --- a/angular/projects/spark-angular/src/lib/components/sprk-card/sprk-card.component.spec.ts +++ b/angular/projects/spark-angular/src/lib/components/sprk-card/sprk-card.component.spec.ts @@ -53,6 +53,26 @@ describe('SparkCardComponent', () => { expect(el.getAttribute('href')).toEqual('/router-test'); }); + it('should set href on icon link if iconRouterLink set', () => { + component.cardType = 'teaser'; + component.media = 'icon'; + component.iconRouterLink = '/router-test-icon'; + fixture.detectChanges(); + element = fixture.nativeElement.querySelector('div'); + const el = element.querySelector('a'); + expect(el.getAttribute('href')).toEqual('/router-test-icon'); + }); + + it('should set href on cta link if ctaRouterLink set', () => { + component.cardType = 'teaser'; + component.media = 'img'; + component.ctaRouterLink = '/router-test-cta'; + fixture.detectChanges(); + element = fixture.nativeElement.querySelector('div.sprk-o-Stack__item'); + const el = element.querySelector('a'); + expect(el.getAttribute('href')).toEqual('/router-test-cta'); + }); + it('should add the correct classes if additionalClassesCta is set on cta link', () => { component.additionalCtaClasses = 'sprk-u-pam'; fixture.detectChanges();