angular-cn/aio/src/app/app.component.spec.ts

64 lines
1.5 KiB
TypeScript
Raw Normal View History

import { async, inject, ComponentFixture, TestBed } from '@angular/core/testing';
import { APP_BASE_HREF } from '@angular/common';
2017-02-02 23:02:23 -08:00
import { AppComponent } from './app.component';
import { AppModule } from './app.module';
import { SearchService } from 'app/search/search.service';
2017-02-02 23:02:23 -08:00
describe('AppComponent', () => {
2017-02-02 23:02:23 -08:00
let component: AppComponent;
let fixture: ComponentFixture<AppComponent>;
2017-02-02 23:02:23 -08:00
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [ AppModule ],
providers: [
{ provide: APP_BASE_HREF, useValue: '/' }
2017-02-02 23:02:23 -08:00
]
});
TestBed.compileComponents();
}));
2017-02-02 23:02:23 -08:00
beforeEach(() => {
fixture = TestBed.createComponent(AppComponent);
component = fixture.componentInstance;
});
2017-02-02 23:02:23 -08:00
it('should create', () => {
expect(component).toBeDefined();
});
describe('isHamburgerVisible', () => {
});
describe('onResize', () => {
it('should update `isSideBySide` accordingly', () => {
component.onResize(1000);
expect(component.isSideBySide).toBe(true);
component.onResize(500);
expect(component.isSideBySide).toBe(false);
});
});
describe('onSearch', () => {
it('should call the search service', inject([SearchService], (search: SearchService) => {
spyOn(search, 'search');
component.onSearch('some query');
expect(search.search).toHaveBeenCalledWith('some query');
}));
});
describe('currentDocument', () => {
});
describe('navigationViews', () => {
});
describe('searchResults', () => {
});
2017-02-02 23:02:23 -08:00
});