Created
June 16, 2017 14:50
-
-
Save benjamincharity/b1319f853f4e907bb61c703413cba6b8 to your computer and use it in GitHub Desktop.
Search Component Test
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
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; | |
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
import { FormsModule } from '@angular/forms'; | |
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | |
import { | |
MdIconModule, | |
MdInputModule, | |
} from '@angular/material'; | |
import { TsSearchComponent } from './search.component'; | |
describe('TsSearchComponent', () => { | |
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
imports: [ | |
BrowserAnimationsModule, | |
FormsModule, | |
MdIconModule, | |
MdInputModule, | |
], | |
declarations: [ | |
TsSearchComponent, | |
], | |
schemas: [ | |
CUSTOM_ELEMENTS_SCHEMA, | |
], | |
}) | |
.compileComponents() | |
.then(() => { | |
this.fixture = TestBed.createComponent(TsSearchComponent); | |
this.component = this.fixture.componentInstance; | |
this.fixture.detectChanges(); | |
}); | |
})); | |
it('should be created', () => { | |
expect(this.component).toBeTruthy(); | |
}); | |
}); |
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
Error: Uncaught (in promise): Error: No value accessor for form control with name: 'query' | |
Error: No value accessor for form control with name: 'query' |
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
import { | |
Component, | |
Input, | |
ViewChild, | |
} from '@angular/core'; | |
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
import { FormsModule } from '@angular/forms'; | |
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | |
import { | |
MdIconModule, | |
MdInputModule, | |
} from '@angular/material'; | |
import { Observable } from 'rxjs/Observable'; | |
import { TsSearchComponent } from './search.component'; | |
import { ElementBase } from '../utilities/element-base'; | |
/* tslint:disable:component-class-suffix */ | |
@Component({ | |
selector: `ts-input`, | |
template: ``, | |
}) | |
class TsInputComponentMock extends ElementBase<string> { | |
@ViewChild(NgModel) model: NgModel; | |
public validationEnabled: boolean = false; | |
public failures; | |
@Input() label: string; | |
@Input() isDisabled: boolean = false; | |
@Input() prefixIcon: string; | |
@Input() canClear: boolean = false; | |
@Input() initialValue: string; | |
@Input() isFocused: boolean; | |
@Input() hideRequiredMarker: boolean = true; | |
@Input() hint: string; | |
} | |
/* tslint-enable: component-class-suffix */ | |
describe('TsSearchComponent', () => { | |
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
imports: [ | |
BrowserAnimationsModule, | |
FormsModule, | |
MdIconModule, | |
MdInputModule, | |
], | |
declarations: [ | |
TsInputComponentMock, | |
TsSearchComponent, | |
], | |
}) | |
.compileComponents() | |
.then(() => { | |
this.fixture = TestBed.createComponent(TsSearchComponent); | |
this.component = this.fixture.componentInstance; | |
this.fixture.detectChanges(); | |
}); | |
})); | |
it('should be created', () => { | |
expect(component).toBeTruthy(); | |
}); | |
}); |
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
[1] 16 06 2017 10:35:51.639:INFO [watcher]: Changed file "/Users/bc/code/Terminus/terminus-ui/src/lib/src/search/search.component.spec.js". | |
[1] Chrome 58.0.3029 (Mac OS X 10.12.5) ERROR | |
[1] { | |
[1] "originalErr": {}, | |
[1] "__zone_symbol__currentTask": { | |
[1] "type": "microTask", | |
[1] "state": "notScheduled", | |
[1] "source": "Promise.then", | |
[1] "zone": "<root>", | |
[1] "cancelFn": null, | |
[1] "runCount": 0 | |
[1] } | |
[1] } | |
[1] | |
[1] Chrome 58.0.3029 (Mac OS X 10.12.5) ERROR | |
[1] { | |
[1] "originalErr": {}, | |
[1] "__zone_symbol__currentTask": { | |
[1] "type": "microTask", | |
[1] "state": "notScheduled", | |
[1] "source": "Promise.then", | |
[1] "zone": "<root>", | |
[1] "cancelFn": null, | |
[1] "runCount": 0 | |
[1] } | |
[1] } | |
[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment