Skip to content
Snippets Groups Projects
Commit 70249389 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6108 Add missing unit test for input

parent e52d5255
No related branches found
No related tags found
Loading
...@@ -32,14 +32,33 @@ describe('NavItemComponent', () => { ...@@ -32,14 +32,33 @@ describe('NavItemComponent', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
describe('routerLink', () => { describe('input', () => {
describe('caption', () => {
it('should set link text', () => {
component.caption = 'Test caption';
fixture.detectChanges();
const captionElement: HTMLParagraphElement = getElementFromFixture(
fixture,
getDataTestIdOf('link-caption'),
);
expect(captionElement.innerHTML).toBe('Test caption');
});
});
describe('to', () => {
it('should set href', () => { it('should set href', () => {
component.to = '/'; component.to = '/';
fixture.detectChanges(); fixture.detectChanges();
const linkElement = getElementFromFixture(fixture, getDataTestIdOf('link-to-/')); const linkElement: HTMLAnchorElement = getElementFromFixture(
fixture,
getDataTestIdOf('link-to-/'),
);
expect(linkElement).toHaveProperty('href'); expect(linkElement).toHaveProperty('href');
}); });
}); });
}); });
});
...@@ -18,7 +18,7 @@ import { RouterLink, RouterLinkActive } from '@angular/router'; ...@@ -18,7 +18,7 @@ import { RouterLink, RouterLinkActive } from '@angular/router';
[attr.data-test-id]="'link-to-' + to" [attr.data-test-id]="'link-to-' + to"
> >
<ng-content select="[icon]" /> <ng-content select="[icon]" />
<p class="text-left text-sm text-text">{{ caption }}</p> <p class="text-left text-sm text-text" data-test-id="link-caption">{{ caption }}</p>
</a>`, </a>`,
}) })
export class NavItemComponent { export class NavItemComponent {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment