Skip to content

Commit

Permalink
Merge pull request #3840 from afebbraro/angular-link
Browse files Browse the repository at this point in the history
add more  card tests
  • Loading branch information
guern1kn authored Feb 4, 2021
2 parents 8044334 + fd82f52 commit dc09aaf
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit dc09aaf

Please sign in to comment.