-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathstyles_spec_large.ts
59 lines (51 loc) · 1.82 KB
/
styles_spec_large.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { runTargetSpec } from '@angular-devkit/architect/testing';
import { tap } from 'rxjs/operators';
import { host, karmaTargetSpec } from '../utils';
describe('Karma Builder global styles', () => {
beforeEach(done => host.initialize().toPromise().then(done, done.fail));
afterEach(done => host.restore().toPromise().then(done, done.fail));
it('works', (done) => {
host.writeMultipleFiles({
'src/styles.css': 'p {display: none}',
'src/app/app.component.ts': `
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: '<p>Hello World</p>'
})
export class AppComponent {
}
`,
'src/app/app.component.spec.ts': `
import { TestBed, async } from '@angular/core/testing';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
HttpModule
],
declarations: [
AppComponent
]
}).compileComponents();
}));
it('should not contain text that is hidden via css', async(() => {
const fixture = TestBed.createComponent(AppComponent);
expect(fixture.nativeElement.innerText).not.toContain('Hello World');
}));
});`,
});
runTargetSpec(host, karmaTargetSpec).pipe(
tap(buildEvent => expect(buildEvent.success).toBe(true)),
).toPromise().then(done, done.fail);
});
});