Closed
Description
Bug Report or Feature Request (mark with an x
)
- [ ] bug report -> please search issues before submitting
- [x] feature request
Versions.
@angular/cli: 1.4.9
node: 6.9.2
os: win32 x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.4.9
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
typescript: 2.3.4
Repro steps.
ng g c componentName
The log given by the failure.
Not an error
Desired functionality.
Almost every component will require tests that examine the generated HTML element. I find myself having to copy the same few lines:
import { DebugElement } from '@angular/core';
...
let de: DebugElement;
let el: HTMLElement;
...
de = fixture.debugElement;
el = de.nativeElement;
in almost every component spec. If I'm not the only one, perhaps it would make sense to put this into the component spec template?
Mention any other details that might be useful.
This follows the testing patterns described on the AngularIO documentation (https://angular.io/guide/testing)