Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make AngularSnapshotSerializer compatible with Ivy #366

Merged
merged 1 commit into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,33 @@
"test": "jest",
"test:watch": "jest --watch",
"test:ci": "jest --runInBand",
"test:coverage": "jest --coverage"
"test:coverage": "jest --coverage",
"postinstall": "ngcc"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.14",
"@angular/common": "~8.2.14",
"@angular/compiler": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/forms": "~8.2.14",
"@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14",
"rxjs": "~6.4.0",
"@angular/animations": "~9.1.0",
"@angular/common": "~9.1.0",
"@angular/compiler": "~9.1.0",
"@angular/core": "~9.1.0",
"@angular/forms": "~9.1.0",
"@angular/platform-browser": "~9.1.0",
"@angular/platform-browser-dynamic": "~9.1.0",
"@angular/router": "~9.1.0",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.25",
"@angular/cli": "~8.3.25",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@angular-devkit/build-angular": "~0.901.0",
"@angular/cli": "~9.1.0",
"@angular/compiler-cli": "~9.1.0",
"@angular/language-service": "~9.1.0",
"@types/jest": "^25.1.1",
"@types/node": "^11.0.0",
"jest": "^25.1.0",
"jest-preset-angular": "file:../",
"ts-node": "^8.0.3",
"typescript": "~3.5.3"
"typescript": "~3.7.5"
}
}
11 changes: 6 additions & 5 deletions example/src/app/__snapshots__/app.component.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,30 @@

exports[`AppComponent snaps 1`] = `
<app-root
__ngContext__={[Function LRootView]}
hasClass={[Function Boolean]}
title={[Function String]}
variableWithPrecedingDolar={[Function Number]}
>
<h1
class="ng-tns-c1-0"
class="ng-tns-c11-0"
>
app works!
<app-calc
class="ng-tns-c1-0"
class="ng-tns-c11-0"
/>
<span
class="ng-tns-c1-0"
class="ng-tns-c11-0"
>
aaa $1234
</span>

<span
class="ng-tns-c1-0 ng-star-inserted"
class="ng-tns-c11-0 ng-star-inserted"
style=""
>
ddd
</span>

\`test'chars""

</h1>
Expand Down
6 changes: 5 additions & 1 deletion example/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { async, fakeAsync, tick, ComponentFixture } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { NO_ERRORS_SCHEMA, ɵivyEnabled as ivyEnabled } from '@angular/core';

import { ConfigureFn, configureTests } from '@lib/testing';

Expand All @@ -26,6 +26,10 @@ describe('AppComponent', () => {
});
}));

it('Ivy should be enabled', () => {
expect(ivyEnabled).toBeTruthy();
});

it('should create the app', async(() => {
const app = component;
expect(app).toBeTruthy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`CalcComponent should snap 1`] = `
<app-calc
__ngContext__={[Function LRootView]}
hasAClass="false"
image={[Function String]}
prop1={[Function Number]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

exports[`MediumComponent snapshot test 1`] = `
<app-medium
__ngContext__={[Function LRootView]}
anotherVar="false"
someVar={[Function Boolean]}
>
<div
class="some-wrapper-class"
>
diary works!

<div
class="inner-class"
>
Expand All @@ -21,6 +21,7 @@ exports[`MediumComponent snapshot test 1`] = `
some html
</span>
</div>

<div>
one more case case
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`NgReflectAsTextComponent snapshots 1`] = `
<app-ng-reflect-as-text>
<app-ng-reflect-as-text
__ngContext__={[Function LRootView]}
>
<p
data-some-attr="ng-reflect-as-attr-arg works"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,30 @@

exports[`OnPushComponent should reflect toppings @Input() via *ngFor 1`] = `
<app-on-push
__ngContext__={[Function LRootView]}
name={[Function String]}
toppings={[Function Array]}
>
<h3>
Chilli pizza
</h3><ul>

<li>
first
</li>

</ul>
</app-on-push>
`;

exports[`OnPushComponent should reflect toppings @Input() via *ngFor 2`] = `
<app-on-push
__ngContext__={[Function LRootView]}
name={[Function String]}
toppings={[Function Array]}
>
<h3>
Chilli pizza
</h3><ul>

<li>
anchovy
</li>
Expand All @@ -34,12 +35,14 @@ exports[`OnPushComponent should reflect toppings @Input() via *ngFor 2`] = `
<li>
chili
</li>

</ul>
</app-on-push>
`;

exports[`OnPushComponent should snapshot pizza name @Input 1`] = `
<app-on-push
__ngContext__={[Function LRootView]}
name={[Function String]}
toppings={[Function Array]}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`SimpleWithStylesComponent should generate snapshot without nghost/ngcontent 1`] = `
<app-simple-with-styles>
<app-simple-with-styles
__ngContext__={[Function LRootView]}
>
<p>
simple-with-styles works!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`SimpleComponent snapshot on nativeElement should be without ng-version 1`] = `
<div
id="root2"
id="root-ng-internal-isolated-2"
>
<p>
simple works!
Expand All @@ -12,7 +12,9 @@ exports[`SimpleComponent snapshot on nativeElement should be without ng-version
`;

exports[`SimpleComponent snapshots 1`] = `
<app-simple>
<app-simple
__ngContext__={[Function LRootView]}
>
<p>
simple works!

Expand Down
Loading