How to use with animations?
See original GitHub issueFirst off, thank you so much for the library. I am having an issue when I have animations triggers though with using this library. Example:
@Component({
selector: 'app-applications-grid',
templateUrl: './applications-grid.component.html',
styleUrls: ['./applications-grid.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
animations: [
trigger('applicationAnimation', [
transition('* => *', [
query(
':enter',
[
style({ opacity: 0, transform: 'translateY(-100px)' }),
stagger(50, [animate('400ms ease-out', style({ opacity: 1, transform: 'none' }))]),
],
{ optional: true }
),
]),
]),
],
})
export class ApplicationsGridComponent {
@Input() applications: ApplicationDetail[];
trackByFn(idx, { name }: ApplicationDetail) {
return name;
}
}
with a template of
<section class="application-grid" [@applicationAnimation]="applications?.length">
<app-applications-grid-item *ngFor="let application of applications; trackBy: trackByFn" [item]="application"></app-applications-grid-item>
</section>
This error is thrown:
HeadlessChrome 0.0.0 (Linux 0.0.0) ApplicationsGridComponent should create FAILED
Error: Found the synthetic property @applicationAnimation. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.
at checkNoSyntheticProp node_modules/@angular/platform-browser/fesm5/platform-browser.js:1296:1)
at EmulatedEncapsulationDomRenderer2.push../node_modules/@angular/platform-browser/fesm5/platform-browser.js.DefaultDomRenderer2.setProperty node_modules/@angular/platform-browser/fesm5/platform-browser.js:1280:1)
at DebugRenderer2.push../node_modules/@angular/core/fesm5/core.js.DebugRenderer2.setProperty node_modules/@angular/core/fesm5/core.js:11207:1)
at setElementProperty node_modules/@angular/core/fesm5/core.js:7966:1)
at checkAndUpdateElementValue node_modules/@angular/core/fesm5/core.js:7917:1)
at checkAndUpdateElementInline node_modules/@angular/core/fesm5/core.js:7864:1)
at checkAndUpdateNodeInline node_modules/@angular/core/fesm5/core.js:10205:1)
at checkAndUpdateNode node_modules/@angular/core/fesm5/core.js:10171:1)
at debugCheckAndUpdateNode node_modules/@angular/core/fesm5/core.js:10804:1)
at debugCheckRenderNodeFn node_modules/@angular/core/fesm5/core.js:10790:1)
HeadlessChrome 0.0.0 (Linux 0.0.0) ApplicationsGridComponent should create FAILED
Error: Found the synthetic property @applicationAnimation. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.
at checkNoSyntheticProp node_modules/@angular/platform-browser/fesm5/platform-browser.js:1296:1)
at EmulatedEncapsulationDomRenderer2.push../node_modules/@angular/platform-browser/fesm5/platform-browser.js.DefaultDomRenderer2.setProperty node_modules/@angular/platform-browser/fesm5/platform-browser.js:1280:1)
at DebugRenderer2.push../node_modules/@angular/core/fesm5/core.js.DebugRenderer2.setProperty node_modules/@angular/core/fesm5/core.js:11207:1)
at setElementProperty node_modules/@angular/core/fesm5/core.js:7966:1)
at checkAndUpdateElementValue node_modules/@angular/core/fesm5/core.js:7917:1)
at checkAndUpdateElementInline node_modules/@angular/core/fesm5/core.js:7864:1)
at checkAndUpdateNodeInline node_modules/@angular/core/fesm5/core.js:10205:1)
at checkAndUpdateNode node_modules/@angular/core/fesm5/core.js:10171:1)
at debugCheckAndUpdateNode node_modules/@angular/core/fesm5/core.js:10804:1)
If I create a testing module that imports the NoopAnimationsModule
,
@NgModule({
imports: [NoopAnimationsModule, ApplicationsModule],
exports: [ApplicationsModule],
})
export class ApplicationsTestModule {
}
describe('ApplicationsGridComponent', () => {
let shallow: Shallow<ApplicationsGridComponent>;
beforeEach(() => {
shallow = new Shallow(ApplicationsGridComponent, ApplicationsTestModule);
});
const applications = mockApps;
it('should create', async () => {
const res = await shallow.render(
`<app-applications-grid [applications]="applications"></app-applications-grid>`,
{ bind: { applications } },
);
});
});
the test fails with the following error:
HeadlessChrome 0.0.0 (Linux 0.0.0) ApplicationsGridComponent should create FAILED
TypeError: this.delegate.createRenderer is not a function
at DebugRendererFactory2.push../node_modules/@angular/core/fesm5/core.js.DebugRendererFactory2.createRenderer node_modules/@angular/core/fesm5/core.js:11067:1)
at createRootData node_modules/@angular/core/fesm5/core.js:10538:1)
at Object.debugCreateRootView [as createRootView] node_modules/@angular/core/fesm5/core.js:10531:1)
at ComponentFactory_.push../node_modules/@angular/core/fesm5/core.js.ComponentFactory_.create node_modules/@angular/core/fesm5/core.js:8361:1)
at initComponent node_modules/@angular/core/fesm5/testing.js:1163:1)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke node_modules/zone.js/dist/zone.js:388:1)
at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke node_modules/zone.js/dist/zone-testing.js:288:1)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke node_modules/zone.js/dist/zone.js:387:1)
at Object.onInvoke node_modules/@angular/core/fesm5/core.js:3671:1)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke node_modules/zone.js/dist/zone.js:38HeadlessChrome 0.0.0 (Linux 0.0.0): Executed 1 of 125 (1 FAILED) (skipped 124) ERROR (0.096 secs / 0.072 secs)
Any ideas?
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (17 by maintainers)
Top Results From Across the Web
CSS Animations - W3Schools
An animation lets an element gradually change from one style to another. You can change as many CSS properties you want, as many...
Read more >Using CSS animations - CSS: Cascading Style Sheets | MDN
CSS animations make it possible to animate transitions from one CSS style configuration to another. Animations consist of two components, ...
Read more >The Ultimate Guide to Animations in CSS - HubSpot Blog
To create a CSS wave animation, you need to create multiple HTML objects to represent your waves. Then you'll apply the rotate animation...
Read more >Animate text or objects - Microsoft Support
Select the object that you want to animate. · On the Animations tab of the ribbon, in the Animation group, click the More...
Read more >Animation for Beginners (Where do I start?)
An animator uses a digital puppet (called a character rig) to position the character, and then use a system of motion paths (or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the positive feedback and (+1 on the details you provided)! You’re close here but instead of creating a separate test module, you’ll use your actual Angular module and “replace”
BrowserAnimationsModule
withNoopAnimationsModule
with Shallow.If you want to do this for all tests (recommended), you can add this line in your test shim to replace that module globally:
Let me know if that works out for you!
@lubek1983 I’d do the testing via jest-marbles or jasmine-marbles if it was me. But for a simple use case, you should be storing a reference to the mock store… otherwise you can’t push mock data through it or check if dispatch has been called. Although this kind of support is proper best handled through stackoverflow than a GitHub issue.