-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from dataramblers/test
Test
- Loading branch information
Showing
3 changed files
with
84 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,35 @@ | ||
import { TestBed, async } from '@angular/core/testing'; | ||
import { AppComponent } from './app.component'; | ||
import {ImageOverviewModule} from './image-overview/image-overview.module'; | ||
import {ImageViewerModule} from './image-viewer/image-viewer.module'; | ||
import {MaterialModule} from './material.module'; | ||
describe('AppComponent', () => { | ||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
AppComponent | ||
], | ||
}).compileComponents(); | ||
})); | ||
it('should create the app', async(() => { | ||
const fixture = TestBed.createComponent(AppComponent); | ||
const app = fixture.debugElement.componentInstance; | ||
expect(app).toBeTruthy(); | ||
})); | ||
it(`should have as title 'app'`, async(() => { | ||
const fixture = TestBed.createComponent(AppComponent); | ||
const app = fixture.debugElement.componentInstance; | ||
expect(app.title).toEqual('app'); | ||
})); | ||
it('should render title in a h1 tag', async(() => { | ||
const fixture = TestBed.createComponent(AppComponent); | ||
fixture.detectChanges(); | ||
const compiled = fixture.debugElement.nativeElement; | ||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); | ||
})); | ||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
AppComponent, | ||
], | ||
imports: [ | ||
ImageOverviewModule, | ||
ImageViewerModule, | ||
MaterialModule | ||
] | ||
}).compileComponents(); | ||
})); | ||
it('should create the app', async(() => { | ||
const fixture = TestBed.createComponent(AppComponent); | ||
const app = fixture.debugElement.componentInstance; | ||
expect(app).toBeTruthy(); | ||
})); | ||
it(`should have as title 'app'`, async(() => { | ||
const fixture = TestBed.createComponent(AppComponent); | ||
const app = fixture.debugElement.componentInstance; | ||
expect(app.title).toEqual('app'); | ||
})); | ||
it('should render title in a h1 tag', async(() => { | ||
const fixture = TestBed.createComponent(AppComponent); | ||
fixture.detectChanges(); | ||
const compiled = fixture.debugElement.nativeElement; | ||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); | ||
})); | ||
}); |
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,25 +1,36 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ImageOverviewComponent } from './image-overview.component'; | ||
import {MaterialModule} from '../material.module'; | ||
import {By} from '@angular/platform-browser'; | ||
|
||
describe('ImageOverviewComponent', () => { | ||
let component: ImageOverviewComponent; | ||
let fixture: ComponentFixture<ImageOverviewComponent>; | ||
let component: ImageOverviewComponent; | ||
let fixture: ComponentFixture<ImageOverviewComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ ImageOverviewComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ ImageOverviewComponent ], | ||
imports: [MaterialModule] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ImageOverviewComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ImageOverviewComponent); | ||
component = fixture.componentInstance; | ||
component.imageNames = Array(10).fill('test'); | ||
component.columns = 2; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should create 10 preview images', () => { | ||
fixture.detectChanges(); | ||
expect(fixture.debugElement.queryAll(By.css('mat-grid-tile')).length === 10) | ||
.toBe(true); | ||
}); | ||
}); |
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,8 +1,30 @@ | ||
import { OsdViewportDirective } from './osd-viewport.directive'; | ||
import {TestBed, ComponentFixture} from '@angular/core/testing'; | ||
import {Component, ViewContainerRef} from '@angular/core'; | ||
|
||
@Component({ | ||
template: `<div #osdViewport></div>` | ||
}) | ||
class TestOsdComponent { | ||
} | ||
|
||
|
||
describe('OsdViewportDirective', () => { | ||
it('should create an instance', () => { | ||
const directive = new OsdViewportDirective(); | ||
expect(directive).toBeTruthy(); | ||
}); | ||
|
||
let component: TestOsdComponent; | ||
let fixture: ComponentFixture<TestOsdComponent>; | ||
let viewContainerRef: ViewContainerRef; | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [TestOsdComponent, OsdViewportDirective] | ||
}); | ||
fixture = TestBed.createComponent(TestOsdComponent); | ||
component = fixture.componentInstance; | ||
viewContainerRef = fixture.elementRef.nativeElement.viewContainer; | ||
}); | ||
|
||
it('should create an instance', () => { | ||
const directive = new OsdViewportDirective(viewContainerRef); | ||
expect(directive).toBeTruthy(); | ||
}); | ||
}); |