-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed configuration so karma could run again without issues and use testing modules from angular * first rc6 intermediate unit test * removed unnecessary config from karma.conf.js * updated karma.travis.conf.js
- Loading branch information
1 parent
6104b55
commit d11f0a9
Showing
5 changed files
with
70 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,54 @@ | ||
import { | ||
TestBed, | ||
inject, | ||
async, | ||
ComponentFixture, | ||
} from '@angular/core/testing'; | ||
|
||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { XHRBackend, Response, ResponseOptions } from '@angular/http'; | ||
import { MockBackend } from '@angular/http/testing'; | ||
import { CovalentCoreModule } from '../platform/core'; | ||
import { DocsAppComponent } from './app.component'; | ||
|
||
describe('Component: App', () => { | ||
|
||
TestBed.configureTestingModule({ | ||
providers: [ | ||
DocsAppComponent, | ||
], | ||
}); | ||
let generalResponses: Map<string, Response> = new Map<string, Response>(); | ||
generalResponses.set('app/assets/icons/teradata.svg', new Response(new ResponseOptions({ | ||
status: 200, body: '<svg></svg>', | ||
}))); | ||
|
||
TestBed.compileComponents(); | ||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
CovalentCoreModule.forRoot(), | ||
RouterTestingModule, | ||
], | ||
declarations: [ | ||
DocsAppComponent, | ||
], | ||
providers: [ | ||
MockBackend, | ||
{ provide: XHRBackend, useExisting: MockBackend }, | ||
], | ||
}); | ||
TestBed.compileComponents(); | ||
})); | ||
|
||
beforeEach(inject([], function(): void { | ||
it('should create the component', async(inject([MockBackend], (mockBackend: MockBackend) => { | ||
let responses: Map<string, Response> = new Map<string, Response>(generalResponses); | ||
mockBackend.connections.subscribe((connection: any) => { | ||
connection.mockRespond(responses.get(connection.request.url)); | ||
}); | ||
|
||
})); | ||
let fixture: ComponentFixture<any> = TestBed.createComponent(DocsAppComponent); | ||
let testComponent: DocsAppComponent = fixture.debugElement.componentInstance; | ||
let element: HTMLElement = fixture.nativeElement; | ||
|
||
it('should create the component', inject([], () => { | ||
|
||
})); | ||
expect(element.querySelector('[title="Covalent"]')).toBeTruthy(); | ||
fixture.detectChanges(); | ||
fixture.whenStable().then(() => { | ||
expect(element.querySelectorAll('md-nav-list[menu-items] a[md-list-item]').length) | ||
.toBe(testComponent.routes.length); | ||
}); | ||
}))); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters