diff --git a/package.json b/package.json index 6eed1511..28085828 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "build": "ng build", "build-lib": "ng build @coreui/angular --prod", "test": "ng test", + "test-lib": "ng test @coreui/angular", "lint": "ng lint", "e2e": "ng e2e", "publish": "cd dist/@coreui/angular/ && npm publish", diff --git a/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav.component.spec.ts b/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav.component.spec.ts index 7e27e05e..8ea28b5a 100644 --- a/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav.component.spec.ts +++ b/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav.component.spec.ts @@ -1,4 +1,6 @@ +import { NO_ERRORS_SCHEMA } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; import { AppSidebarNavComponent } from './app-sidebar-nav.component'; @@ -8,9 +10,11 @@ describe('AppSidebarNavComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ AppSidebarNavComponent ] + declarations: [AppSidebarNavComponent], + imports: [RouterTestingModule], + schemas: [NO_ERRORS_SCHEMA], }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { diff --git a/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-item-class.pipe.spec.ts b/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-item-class.pipe.spec.ts index 0779f426..722fc56c 100644 --- a/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-item-class.pipe.spec.ts +++ b/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-item-class.pipe.spec.ts @@ -1,8 +1,9 @@ +import { SidebarNavHelper } from '../app-sidebar-nav.service'; import { AppSidebarNavItemClassPipe } from './app-sidebar-nav-item-class.pipe'; describe('SidebarNavItemClassPipe', () => { it('create an instance', () => { - const pipe = new AppSidebarNavItemClassPipe(); + const pipe = new AppSidebarNavItemClassPipe(new SidebarNavHelper()); expect(pipe).toBeTruthy(); }); }); diff --git a/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-label.component.spec.ts b/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-label.component.spec.ts index dbd4569c..ff9c1638 100644 --- a/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-label.component.spec.ts +++ b/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-label.component.spec.ts @@ -1,5 +1,7 @@ +import { NO_ERRORS_SCHEMA } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - +import { SidebarNavHelper } from '../app-sidebar-nav.service'; +import { AppSidebarNavBadgePipe } from './app-sidebar-nav-badge.pipe'; import { AppSidebarNavLabelComponent } from './app-sidebar-nav-label.component'; describe('AppSidebarNavLabelComponent', () => { @@ -8,14 +10,17 @@ describe('AppSidebarNavLabelComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ AppSidebarNavLabelComponent ] + declarations: [AppSidebarNavLabelComponent, AppSidebarNavBadgePipe], + providers: [SidebarNavHelper], + schemas: [NO_ERRORS_SCHEMA], }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(AppSidebarNavLabelComponent); component = fixture.componentInstance; + component.item = {}; fixture.detectChanges(); }); diff --git a/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-link.component.spec.ts b/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-link.component.spec.ts index 58bed87b..5a6b3c71 100644 --- a/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-link.component.spec.ts +++ b/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-link.component.spec.ts @@ -1,6 +1,9 @@ +import { NO_ERRORS_SCHEMA } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - +import { RouterTestingModule } from '@angular/router/testing'; +import { AppSidebarNavBadgePipe } from './app-sidebar-nav-badge.pipe'; import { AppSidebarNavLinkComponent } from './app-sidebar-nav-link.component'; +import { AppSidebarNavLinkPipe } from './app-sidebar-nav-link.pipe'; describe('AppSidebarNavLinkComponent', () => { let component: AppSidebarNavLinkComponent; @@ -8,14 +11,23 @@ describe('AppSidebarNavLinkComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ AppSidebarNavLinkComponent ] + declarations: [ + AppSidebarNavLinkComponent, + AppSidebarNavLinkPipe, + AppSidebarNavBadgePipe, + ], + imports: [RouterTestingModule], + schemas: [NO_ERRORS_SCHEMA], }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(AppSidebarNavLinkComponent); component = fixture.componentInstance; + component.item = { + url: '', + }; fixture.detectChanges(); }); diff --git a/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-title.component.spec.ts b/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-title.component.spec.ts index b133a061..a26c018c 100644 --- a/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-title.component.spec.ts +++ b/projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-title.component.spec.ts @@ -8,14 +8,15 @@ describe('AppSidebarNavTitleComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ AppSidebarNavTitleComponent ] + declarations: [AppSidebarNavTitleComponent], }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(AppSidebarNavTitleComponent); component = fixture.componentInstance; + component.item = {}; fixture.detectChanges(); });