-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove ng* attributes from component snapshots
- Loading branch information
1 parent
61c391a
commit ba496a4
Showing
9 changed files
with
141 additions
and
9 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
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
31 changes: 31 additions & 0 deletions
31
.../app/a-bit-more-complex-component/__snapshots__/a-bit-more-complex.component.spec.ts.snap
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ABitMoreComplexComponent snapshot test 1`] = ` | ||
<app-a-bit-more-complex | ||
anotherVar="false" | ||
someVar={[Function Boolean]} | ||
> | ||
<div | ||
class="kek" | ||
> | ||
diary works! | ||
<div | ||
class="inner-class" | ||
> | ||
<div> | ||
another case | ||
</div> | ||
</div> | ||
<div> | ||
one more case case | ||
</div> | ||
<div> | ||
<app-child-component | ||
kek="someVar" | ||
> | ||
stubbedBody | ||
</app-child-component> | ||
</div> | ||
</div> | ||
</app-a-bit-more-complex> | ||
`; |
34 changes: 34 additions & 0 deletions
34
example/src/app/a-bit-more-complex-component/a-bit-more-complex.component.spec.ts
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* tslint:disable:no-unused-variable */ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ABitMoreComplexComponent } from './a-bit-more-complex.component'; | ||
import { ChildComponent } from './child.component'; | ||
|
||
describe('ABitMoreComplexComponent', () => { | ||
let component: ABitMoreComplexComponent; | ||
let fixture: ComponentFixture<ABitMoreComplexComponent>; | ||
|
||
beforeEach( | ||
async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ABitMoreComplexComponent, ChildComponent], | ||
}) | ||
.overrideComponent(ChildComponent, {set: {template: 'stubbedBody'}}) | ||
.compileComponents(); | ||
}), | ||
); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ABitMoreComplexComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('snapshot test', () => { | ||
expect(fixture).toMatchSnapshot(); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
example/src/app/a-bit-more-complex-component/a-bit-more-complex.component.ts
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-a-bit-more-complex', | ||
template: ` | ||
<div class="kek"> | ||
diary works! | ||
<div *ngIf="someVar" class="inner-class"> | ||
<div *ngIf="anotherVar" class="inner-hidden"></div> | ||
<div>another case</div> | ||
</div> | ||
<div>one more case case</div> | ||
<div><app-child-component kek="someVar"></app-child-component></div> | ||
</div> | ||
`, | ||
styles: [ | ||
`.kekq { color: red }` | ||
] | ||
}) | ||
export class ABitMoreComplexComponent implements OnInit { | ||
someVar = true; | ||
anotherVar = false; | ||
|
||
constructor() {} | ||
|
||
ngOnInit() {} | ||
} |
27 changes: 27 additions & 0 deletions
27
example/src/app/a-bit-more-complex-component/child.component.ts
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-child-component', | ||
template: ` | ||
<div class="kek"> | ||
{{ kek }} | ||
<div> | ||
rly | ||
<p>complex</p> | ||
<div>component | ||
<div>oh my god!</div> | ||
</div> | ||
</div> | ||
</div> | ||
`, | ||
styles: [ | ||
`.kek { color: red }` | ||
] | ||
}) | ||
export class ChildComponent implements OnInit { | ||
@Input() kek = null; | ||
|
||
constructor() {} | ||
|
||
ngOnInit() {} | ||
} |
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
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
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 |
---|---|---|
|
@@ -4,7 +4,6 @@ exports[`SimpleComponent snapshots 1`] = ` | |
<app-simple> | ||
<p> | ||
simple works! | ||
</p> | ||
</app-simple> | ||
`; |