@@ -2474,46 +2477,47 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async';
`
- })
- class Cmp {
- // TODO(issue/24571): remove '!'.
- public exp !: boolean;
- }
+ })
+ class Cmp {
+ // TODO(issue/24571): remove '!'.
+ public exp !: boolean;
+ }
- TestBed.configureTestingModule({declarations: [Cmp]});
+ TestBed.configureTestingModule({declarations: [Cmp]});
- const engine = TestBed.get(ɵAnimationEngine);
- const fixture = TestBed.createComponent(Cmp);
- const cmp = fixture.componentInstance;
- const container = fixture.elementRef.nativeElement;
+ const engine = TestBed.get(ɵAnimationEngine);
+ const fixture = TestBed.createComponent(Cmp);
+ const cmp = fixture.componentInstance;
+ const container = fixture.elementRef.nativeElement;
- cmp.exp = true;
- fixture.detectChanges();
- engine.flush();
+ cmp.exp = true;
+ fixture.detectChanges();
+ engine.flush();
- let players = getLog();
- resetLog();
- expect(players.length).toEqual(2);
- const [p1, p2] = players;
+ let players = getLog();
+ resetLog();
+ expect(players.length).toEqual(2);
+ const [p1, p2] = players;
- expect(p1.element.classList.contains('a'));
- expect(p2.element.classList.contains('d'));
+ expect(p1.element.classList.contains('a'));
+ expect(p2.element.classList.contains('d'));
- cmp.exp = false;
- fixture.detectChanges();
- engine.flush();
+ cmp.exp = false;
+ fixture.detectChanges();
+ engine.flush();
- players = getLog();
- resetLog();
- expect(players.length).toEqual(2);
- const [p3, p4] = players;
+ players = getLog();
+ resetLog();
+ expect(players.length).toEqual(2);
+ const [p3, p4] = players;
- expect(p3.element.classList.contains('a'));
- expect(p4.element.classList.contains('d'));
- });
+ expect(p3.element.classList.contains('a'));
+ expect(p4.element.classList.contains('d'));
+ });
- it('should collect multiple root levels of :enter and :leave nodes', () => {
- @Component({
+ fixmeIvy('unknown').it(
+ 'should collect multiple root levels of :enter and :leave nodes', () => {
+ @Component({
selector: 'ani-cmp',
animations: [
trigger('pageAnimation', [
@@ -2548,141 +2552,142 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async';
`
})
class Cmp {
- get title() {
- if (this.page1) {
- return 'hello from page1';
+ get title() {
+ if (this.page1) {
+ return 'hello from page1';
+ }
+ return 'greetings from page2';
+ }
+
+ page1 = false;
+ page2 = false;
+ loading = false;
+
+ get status() {
+ if (this.loading) return 'loading';
+ if (this.page1) return 'page1';
+ if (this.page2) return 'page2';
+ return '';
+ }
}
- return 'greetings from page2';
- }
- page1 = false;
- page2 = false;
- loading = false;
+ TestBed.configureTestingModule({declarations: [Cmp]});
- get status() {
- if (this.loading) return 'loading';
- if (this.page1) return 'page1';
- if (this.page2) return 'page2';
- return '';
- }
- }
+ const engine = TestBed.get(ɵAnimationEngine);
+ const fixture = TestBed.createComponent(Cmp);
+ const cmp = fixture.componentInstance;
+ cmp.loading = true;
+ fixture.detectChanges();
+ engine.flush();
- TestBed.configureTestingModule({declarations: [Cmp]});
+ let players = getLog();
+ resetLog();
+ cancelAllPlayers(players);
- const engine = TestBed.get(ɵAnimationEngine);
- const fixture = TestBed.createComponent(Cmp);
- const cmp = fixture.componentInstance;
- cmp.loading = true;
- fixture.detectChanges();
- engine.flush();
+ cmp.page1 = true;
+ cmp.loading = false;
+ fixture.detectChanges();
+ engine.flush();
- let players = getLog();
- resetLog();
- cancelAllPlayers(players);
+ let p1: MockAnimationPlayer;
+ let p2: MockAnimationPlayer;
+ let p3: MockAnimationPlayer;
- cmp.page1 = true;
- cmp.loading = false;
- fixture.detectChanges();
- engine.flush();
+ players = getLog();
+ expect(players.length).toEqual(3);
+ [p1, p2, p3] = players;
- let p1: MockAnimationPlayer;
- let p2: MockAnimationPlayer;
- let p3: MockAnimationPlayer;
+ expect(p1.element.classList.contains('loading')).toBe(true);
+ expect(p2.element.classList.contains('title')).toBe(true);
+ expect(p3.element.classList.contains('page1')).toBe(true);
- players = getLog();
- expect(players.length).toEqual(3);
- [p1, p2, p3] = players;
+ resetLog();
+ cancelAllPlayers(players);
- expect(p1.element.classList.contains('loading')).toBe(true);
- expect(p2.element.classList.contains('title')).toBe(true);
- expect(p3.element.classList.contains('page1')).toBe(true);
+ cmp.page1 = false;
+ cmp.loading = true;
+ fixture.detectChanges();
- resetLog();
- cancelAllPlayers(players);
+ players = getLog();
+ cancelAllPlayers(players);
- cmp.page1 = false;
- cmp.loading = true;
- fixture.detectChanges();
+ expect(players.length).toEqual(3);
+ [p1, p2, p3] = players;
- players = getLog();
- cancelAllPlayers(players);
+ expect(p1.element.classList.contains('title')).toBe(true);
+ expect(p2.element.classList.contains('page1')).toBe(true);
+ expect(p3.element.classList.contains('loading')).toBe(true);
- expect(players.length).toEqual(3);
- [p1, p2, p3] = players;
+ resetLog();
+ cancelAllPlayers(players);
- expect(p1.element.classList.contains('title')).toBe(true);
- expect(p2.element.classList.contains('page1')).toBe(true);
- expect(p3.element.classList.contains('loading')).toBe(true);
+ cmp.page2 = true;
+ cmp.loading = false;
+ fixture.detectChanges();
+ engine.flush();
- resetLog();
- cancelAllPlayers(players);
+ players = getLog();
+ expect(players.length).toEqual(3);
+ [p1, p2, p3] = players;
- cmp.page2 = true;
- cmp.loading = false;
- fixture.detectChanges();
- engine.flush();
+ expect(p1.element.classList.contains('loading')).toBe(true);
+ expect(p2.element.classList.contains('title')).toBe(true);
+ expect(p3.element.classList.contains('page2')).toBe(true);
+ });
- players = getLog();
- expect(players.length).toEqual(3);
- [p1, p2, p3] = players;
-
- expect(p1.element.classList.contains('loading')).toBe(true);
- expect(p2.element.classList.contains('title')).toBe(true);
- expect(p3.element.classList.contains('page2')).toBe(true);
- });
-
- it('should emulate leave animation callbacks for all sub elements that have leave triggers within the component',
- fakeAsync(() => {
- @Component({
- selector: 'ani-cmp',
- animations: [
- trigger('parent', []), trigger('child', []),
- trigger(
- 'childWithAnimation',
- [
- transition(
- ':leave',
- [
- animate(1000, style({background: 'red'})),
- ]),
- ])
- ],
- template: `
+ fixmeIvy('unknown').it(
+ 'should emulate leave animation callbacks for all sub elements that have leave triggers within the component',
+ fakeAsync(() => {
+ @Component({
+ selector: 'ani-cmp',
+ animations: [
+ trigger('parent', []), trigger('child', []),
+ trigger(
+ 'childWithAnimation',
+ [
+ transition(
+ ':leave',
+ [
+ animate(1000, style({background: 'red'})),
+ ]),
+ ])
+ ],
+ template: `
`
- })
- class Cmp {
- // TODO(issue/24571): remove '!'.
- public exp !: boolean;
- public log: string[] = [];
- callback(event: any) {
- this.log.push(event.element.getAttribute('data-name') + '-' + event.phaseName);
- }
- }
+ })
+ class Cmp {
+ // TODO(issue/24571): remove '!'.
+ public exp !: boolean;
+ public log: string[] = [];
+ callback(event: any) {
+ this.log.push(event.element.getAttribute('data-name') + '-' + event.phaseName);
+ }
+ }
- TestBed.configureTestingModule({declarations: [Cmp]});
+ TestBed.configureTestingModule({declarations: [Cmp]});
- const engine = TestBed.get(ɵAnimationEngine);
- const fixture = TestBed.createComponent(Cmp);
- const cmp = fixture.componentInstance;
+ const engine = TestBed.get(ɵAnimationEngine);
+ const fixture = TestBed.createComponent(Cmp);
+ const cmp = fixture.componentInstance;
- cmp.exp = true;
- fixture.detectChanges();
- flushMicrotasks();
- cmp.log = [];
+ cmp.exp = true;
+ fixture.detectChanges();
+ flushMicrotasks();
+ cmp.log = [];
- cmp.exp = false;
- fixture.detectChanges();
- flushMicrotasks();
- expect(cmp.log).toEqual([
- 'c1-start', 'c1-done', 'c2-start', 'c2-done', 'p-start', 'c3-start', 'c3-done',
- 'p-done'
- ]);
- }));
+ cmp.exp = false;
+ fixture.detectChanges();
+ flushMicrotasks();
+ expect(cmp.log).toEqual([
+ 'c1-start', 'c1-done', 'c2-start', 'c2-done', 'p-start', 'c3-start', 'c3-done',
+ 'p-done'
+ ]);
+ }));
it('should build, but not run sub triggers when a parent animation is scheduled', () => {
@Component({
@@ -2732,23 +2737,24 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async';
expect(engine.players[0].getRealPlayer()).toBe(players[1]);
});
- it('should fire and synchronize the start/done callbacks on sub triggers even if they are not allowed to animate within the animation',
- fakeAsync(() => {
- @Component({
- selector: 'parent-cmp',
- animations: [
- trigger(
- 'parent',
- [
- transition(
- '* => go',
- [
- style({height: '0px'}),
- animate(1000, style({height: '100px'})),
- ]),
- ]),
- ],
- template: `
+ fixmeIvy('unknown').it(
+ 'should fire and synchronize the start/done callbacks on sub triggers even if they are not allowed to animate within the animation',
+ fakeAsync(() => {
+ @Component({
+ selector: 'parent-cmp',
+ animations: [
+ trigger(
+ 'parent',
+ [
+ transition(
+ '* => go',
+ [
+ style({height: '0px'}),
+ animate(1000, style({height: '100px'})),
+ ]),
+ ]),
+ ],
+ template: `
`
- })
- class ParentCmp {
- @ViewChild('child') public childCmp: any;
+ })
+ class ParentCmp {
+ @ViewChild('child') public childCmp: any;
- public exp: any;
- public log: string[] = [];
- public remove = false;
+ public exp: any;
+ public log: string[] = [];
+ public remove = false;
- track(event: any) { this.log.push(`${event.triggerName}-${event.phaseName}`); }
- }
+ track(event: any) { this.log.push(`${event.triggerName}-${event.phaseName}`); }
+ }
- @Component({
- selector: 'child-cmp',
- animations: [
- trigger(
- 'child',
- [
- transition(
- '* => go',
- [
- style({width: '0px'}),
- animate(1000, style({width: '100px'})),
- ]),
- ]),
- ],
- template: `
+ @Component({
+ selector: 'child-cmp',
+ animations: [
+ trigger(
+ 'child',
+ [
+ transition(
+ '* => go',
+ [
+ style({width: '0px'}),
+ animate(1000, style({width: '100px'})),
+ ]),
+ ]),
+ ],
+ template: `
`
- })
- class ChildCmp {
- public exp: any;
- public log: string[] = [];
- track(event: any) { this.log.push(`${event.triggerName}-${event.phaseName}`); }
- }
+ })
+ class ChildCmp {
+ public exp: any;
+ public log: string[] = [];
+ track(event: any) { this.log.push(`${event.triggerName}-${event.phaseName}`); }
+ }
- TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
- const engine = TestBed.get(ɵAnimationEngine);
- const fixture = TestBed.createComponent(ParentCmp);
- fixture.detectChanges();
- flushMicrotasks();
+ TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
+ const engine = TestBed.get(ɵAnimationEngine);
+ const fixture = TestBed.createComponent(ParentCmp);
+ fixture.detectChanges();
+ flushMicrotasks();
- const cmp = fixture.componentInstance;
- const child = cmp.childCmp;
+ const cmp = fixture.componentInstance;
+ const child = cmp.childCmp;
- expect(cmp.log).toEqual(['parent-start', 'parent-done']);
- expect(child.log).toEqual(['child-start', 'child-done']);
+ expect(cmp.log).toEqual(['parent-start', 'parent-done']);
+ expect(child.log).toEqual(['child-start', 'child-done']);
- cmp.log = [];
- child.log = [];
- cmp.exp = 'go';
- cmp.childCmp.exp = 'go';
- fixture.detectChanges();
- flushMicrotasks();
+ cmp.log = [];
+ child.log = [];
+ cmp.exp = 'go';
+ cmp.childCmp.exp = 'go';
+ fixture.detectChanges();
+ flushMicrotasks();
- expect(cmp.log).toEqual(['parent-start']);
- expect(child.log).toEqual(['child-start']);
+ expect(cmp.log).toEqual(['parent-start']);
+ expect(child.log).toEqual(['child-start']);
- const players = engine.players;
- expect(players.length).toEqual(1);
- players[0].finish();
+ const players = engine.players;
+ expect(players.length).toEqual(1);
+ players[0].finish();
- expect(cmp.log).toEqual(['parent-start', 'parent-done']);
- expect(child.log).toEqual(['child-start', 'child-done']);
+ expect(cmp.log).toEqual(['parent-start', 'parent-done']);
+ expect(child.log).toEqual(['child-start', 'child-done']);
- cmp.log = [];
- child.log = [];
- cmp.remove = true;
- fixture.detectChanges();
- flushMicrotasks();
+ cmp.log = [];
+ child.log = [];
+ cmp.remove = true;
+ fixture.detectChanges();
+ flushMicrotasks();
- expect(cmp.log).toEqual(['parent-start', 'parent-done']);
- expect(child.log).toEqual(['child-start', 'child-done']);
- }));
+ expect(cmp.log).toEqual(['parent-start', 'parent-done']);
+ expect(child.log).toEqual(['child-start', 'child-done']);
+ }));
- it('should fire and synchronize the start/done callbacks on multiple blocked sub triggers',
- fakeAsync(() => {
- @Component({
- selector: 'cmp',
- animations: [
- trigger(
- 'parent1',
- [
- transition(
- '* => go, * => go-again',
- [
- style({opacity: 0}),
- animate('1s', style({opacity: 1})),
- ]),
- ]),
- trigger(
- 'parent2',
- [
- transition(
- '* => go, * => go-again',
- [
- style({lineHeight: '0px'}),
- animate('1s', style({lineHeight: '10px'})),
- ]),
- ]),
- trigger(
- 'child1',
- [
- transition(
- '* => go, * => go-again',
- [
- style({width: '0px'}),
- animate('1s', style({width: '100px'})),
- ]),
- ]),
- trigger(
- 'child2',
- [
- transition(
- '* => go, * => go-again',
- [
- style({height: '0px'}),
- animate('1s', style({height: '100px'})),
- ]),
- ]),
- ],
- template: `
+ fixmeIvy('unknown').it(
+ 'should fire and synchronize the start/done callbacks on multiple blocked sub triggers',
+ fakeAsync(() => {
+ @Component({
+ selector: 'cmp',
+ animations: [
+ trigger(
+ 'parent1',
+ [
+ transition(
+ '* => go, * => go-again',
+ [
+ style({opacity: 0}),
+ animate('1s', style({opacity: 1})),
+ ]),
+ ]),
+ trigger(
+ 'parent2',
+ [
+ transition(
+ '* => go, * => go-again',
+ [
+ style({lineHeight: '0px'}),
+ animate('1s', style({lineHeight: '10px'})),
+ ]),
+ ]),
+ trigger(
+ 'child1',
+ [
+ transition(
+ '* => go, * => go-again',
+ [
+ style({width: '0px'}),
+ animate('1s', style({width: '100px'})),
+ ]),
+ ]),
+ trigger(
+ 'child2',
+ [
+ transition(
+ '* => go, * => go-again',
+ [
+ style({height: '0px'}),
+ animate('1s', style({height: '100px'})),
+ ]),
+ ]),
+ ],
+ template: `
`
- })
- class Cmp {
- public parent1Exp = '';
- public parent2Exp = '';
- public child1Exp = '';
- public child2Exp = '';
- public log: string[] = [];
+ })
+ class Cmp {
+ public parent1Exp = '';
+ public parent2Exp = '';
+ public child1Exp = '';
+ public child2Exp = '';
+ public log: string[] = [];
- track(event: any) { this.log.push(`${event.triggerName}-${event.phaseName}`); }
- }
+ track(event: any) { this.log.push(`${event.triggerName}-${event.phaseName}`); }
+ }
- TestBed.configureTestingModule({declarations: [Cmp]});
- const engine = TestBed.get(ɵAnimationEngine);
- const fixture = TestBed.createComponent(Cmp);
- fixture.detectChanges();
- flushMicrotasks();
+ TestBed.configureTestingModule({declarations: [Cmp]});
+ const engine = TestBed.get(ɵAnimationEngine);
+ const fixture = TestBed.createComponent(Cmp);
+ fixture.detectChanges();
+ flushMicrotasks();
- const cmp = fixture.componentInstance;
- cmp.log = [];
- cmp.parent1Exp = 'go';
- cmp.parent2Exp = 'go';
- cmp.child1Exp = 'go';
- cmp.child2Exp = 'go';
- fixture.detectChanges();
- flushMicrotasks();
+ const cmp = fixture.componentInstance;
+ cmp.log = [];
+ cmp.parent1Exp = 'go';
+ cmp.parent2Exp = 'go';
+ cmp.child1Exp = 'go';
+ cmp.child2Exp = 'go';
+ fixture.detectChanges();
+ flushMicrotasks();
- expect(cmp.log).toEqual(
- ['parent1-start', 'parent2-start', 'child1-start', 'child2-start']);
+ expect(cmp.log).toEqual(
+ ['parent1-start', 'parent2-start', 'child1-start', 'child2-start']);
- cmp.parent1Exp = 'go-again';
- cmp.parent2Exp = 'go-again';
- cmp.child1Exp = 'go-again';
- cmp.child2Exp = 'go-again';
- fixture.detectChanges();
- flushMicrotasks();
- }));
+ cmp.parent1Exp = 'go-again';
+ cmp.parent2Exp = 'go-again';
+ cmp.child1Exp = 'go-again';
+ cmp.child2Exp = 'go-again';
+ fixture.detectChanges();
+ flushMicrotasks();
+ }));
it('should stretch the starting keyframe of a child animation queries are issued by the parent',
() => {
diff --git a/packages/core/test/animation/animation_router_integration_spec.ts b/packages/core/test/animation/animation_router_integration_spec.ts
index 3225a8727f..2dbc90591e 100644
--- a/packages/core/test/animation/animation_router_integration_spec.ts
+++ b/packages/core/test/animation/animation_router_integration_spec.ts
@@ -11,6 +11,7 @@ import {MockAnimationDriver, MockAnimationPlayer} from '@angular/animations/brow
import {Component, HostBinding} from '@angular/core';
import {TestBed, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
+import {fixmeIvy} from '@angular/private/testing';
import {ActivatedRoute, Router, RouterOutlet} from '@angular/router';
import {RouterTestingModule} from '@angular/router/testing';
@@ -33,349 +34,354 @@ import {RouterTestingModule} from '@angular/router/testing';
});
});
- it('should query the old and new routes via :leave and :enter', fakeAsync(() => {
- @Component({
- animations: [
- trigger(
- 'routerAnimations',
- [
- transition(
- 'page1 => page2',
- [
- query(':leave', animateChild()),
- query(':enter', animateChild()),
- ]),
- ]),
- ],
- template: `
+ fixmeIvy('unknown').it(
+ 'should query the old and new routes via :leave and :enter', fakeAsync(() => {
+ @Component({
+ animations: [
+ trigger(
+ 'routerAnimations',
+ [
+ transition(
+ 'page1 => page2',
+ [
+ query(':leave', animateChild()),
+ query(':enter', animateChild()),
+ ]),
+ ]),
+ ],
+ template: `
`
- })
- class ContainerCmp {
- constructor(public router: Router) {}
+ })
+ class ContainerCmp {
+ constructor(public router: Router) {}
- prepareRouteAnimation(r: RouterOutlet) {
- const animation = r.activatedRouteData['animation'];
- const value = animation ? animation['value'] : null;
- return value;
- }
- }
+ prepareRouteAnimation(r: RouterOutlet) {
+ const animation = r.activatedRouteData['animation'];
+ const value = animation ? animation['value'] : null;
+ return value;
+ }
+ }
- @Component({
- selector: 'page1',
- template: `page1`,
- animations: [
- trigger(
- 'page1Animation',
- [
- transition(
- ':leave',
- [
- style({width: '200px'}),
- animate(1000, style({width: '0px'})),
- ]),
- ]),
- ]
- })
- class Page1Cmp {
- @HostBinding('@page1Animation') public doAnimate = true;
- }
+ @Component({
+ selector: 'page1',
+ template: `page1`,
+ animations: [
+ trigger(
+ 'page1Animation',
+ [
+ transition(
+ ':leave',
+ [
+ style({width: '200px'}),
+ animate(1000, style({width: '0px'})),
+ ]),
+ ]),
+ ]
+ })
+ class Page1Cmp {
+ @HostBinding('@page1Animation') public doAnimate = true;
+ }
- @Component({
- selector: 'page2',
- template: `page2`,
- animations: [
- trigger(
- 'page2Animation',
- [
- transition(
- ':enter',
- [
- style({opacity: 0}),
- animate(1000, style({opacity: 1})),
- ]),
- ]),
- ]
- })
- class Page2Cmp {
- @HostBinding('@page2Animation') public doAnimate = true;
- }
+ @Component({
+ selector: 'page2',
+ template: `page2`,
+ animations: [
+ trigger(
+ 'page2Animation',
+ [
+ transition(
+ ':enter',
+ [
+ style({opacity: 0}),
+ animate(1000, style({opacity: 1})),
+ ]),
+ ]),
+ ]
+ })
+ class Page2Cmp {
+ @HostBinding('@page2Animation') public doAnimate = true;
+ }
- TestBed.configureTestingModule({
- declarations: [Page1Cmp, Page2Cmp, ContainerCmp],
- imports: [RouterTestingModule.withRoutes([
- {path: 'page1', component: Page1Cmp, data: makeAnimationData('page1')},
- {path: 'page2', component: Page2Cmp, data: makeAnimationData('page2')}
- ])]
- });
+ TestBed.configureTestingModule({
+ declarations: [Page1Cmp, Page2Cmp, ContainerCmp],
+ imports: [RouterTestingModule.withRoutes([
+ {path: 'page1', component: Page1Cmp, data: makeAnimationData('page1')},
+ {path: 'page2', component: Page2Cmp, data: makeAnimationData('page2')}
+ ])]
+ });
- const engine = TestBed.get(ɵAnimationEngine);
- const fixture = TestBed.createComponent(ContainerCmp);
- const cmp = fixture.componentInstance;
- cmp.router.initialNavigation();
- tick();
- fixture.detectChanges();
- engine.flush();
+ const engine = TestBed.get(ɵAnimationEngine);
+ const fixture = TestBed.createComponent(ContainerCmp);
+ const cmp = fixture.componentInstance;
+ cmp.router.initialNavigation();
+ tick();
+ fixture.detectChanges();
+ engine.flush();
- cmp.router.navigateByUrl('/page1');
- tick();
- fixture.detectChanges();
- engine.flush();
+ cmp.router.navigateByUrl('/page1');
+ tick();
+ fixture.detectChanges();
+ engine.flush();
- cmp.router.navigateByUrl('/page2');
- tick();
- fixture.detectChanges();
- engine.flush();
+ cmp.router.navigateByUrl('/page2');
+ tick();
+ fixture.detectChanges();
+ engine.flush();
- const player = engine.players[0] !;
- const groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
- const players = groupPlayer.players as MockAnimationPlayer[];
+ const player = engine.players[0] !;
+ const groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
+ const players = groupPlayer.players as MockAnimationPlayer[];
- expect(players.length).toEqual(2);
- const [p1, p2] = players;
+ expect(players.length).toEqual(2);
+ const [p1, p2] = players;
- expect(p1.duration).toEqual(1000);
- expect(p1.keyframes).toEqual([
- {offset: 0, width: '200px'},
- {offset: 1, width: '0px'},
- ]);
+ expect(p1.duration).toEqual(1000);
+ expect(p1.keyframes).toEqual([
+ {offset: 0, width: '200px'},
+ {offset: 1, width: '0px'},
+ ]);
- expect(p2.duration).toEqual(2000);
- expect(p2.keyframes).toEqual([
- {offset: 0, opacity: '0'},
- {offset: .5, opacity: '0'},
- {offset: 1, opacity: '1'},
- ]);
- }));
+ expect(p2.duration).toEqual(2000);
+ expect(p2.keyframes).toEqual([
+ {offset: 0, opacity: '0'},
+ {offset: .5, opacity: '0'},
+ {offset: 1, opacity: '1'},
+ ]);
+ }));
- it('should allow inner enter animations to be emulated within a routed item', fakeAsync(() => {
- @Component({
- animations: [
- trigger(
- 'routerAnimations',
- [
- transition(
- 'page1 => page2',
- [
- query(':enter', animateChild()),
- ]),
- ]),
- ],
- template: `
+ fixmeIvy('unknown').it(
+ 'should allow inner enter animations to be emulated within a routed item', fakeAsync(() => {
+ @Component({
+ animations: [
+ trigger(
+ 'routerAnimations',
+ [
+ transition(
+ 'page1 => page2',
+ [
+ query(':enter', animateChild()),
+ ]),
+ ]),
+ ],
+ template: `
`
- })
- class ContainerCmp {
- constructor(public router: Router) {}
+ })
+ class ContainerCmp {
+ constructor(public router: Router) {}
- prepareRouteAnimation(r: RouterOutlet) {
- const animation = r.activatedRouteData['animation'];
- const value = animation ? animation['value'] : null;
- return value;
- }
- }
+ prepareRouteAnimation(r: RouterOutlet) {
+ const animation = r.activatedRouteData['animation'];
+ const value = animation ? animation['value'] : null;
+ return value;
+ }
+ }
- @Component({selector: 'page1', template: `page1`, animations: []})
- class Page1Cmp {
- }
+ @Component({selector: 'page1', template: `page1`, animations: []})
+ class Page1Cmp {
+ }
- @Component({
- selector: 'page2',
- template: `
+ @Component({
+ selector: 'page2',
+ template: `
Page 2
`,
- animations: [
- trigger(
- 'page2Animation',
- [
- transition(
- ':enter',
- [query('.if-one', animateChild()), query('.if-two', animateChild())]),
- ]),
- trigger(
- 'ifAnimation',
- [transition(
- ':enter', [style({opacity: 0}), animate(1000, style({opacity: 1}))])])
- ]
- })
- class Page2Cmp {
- @HostBinding('@page2Animation') public doAnimate = true;
+ animations: [
+ trigger(
+ 'page2Animation',
+ [
+ transition(
+ ':enter',
+ [query('.if-one', animateChild()), query('.if-two', animateChild())]),
+ ]),
+ trigger(
+ 'ifAnimation',
+ [transition(
+ ':enter', [style({opacity: 0}), animate(1000, style({opacity: 1}))])])
+ ]
+ })
+ class Page2Cmp {
+ @HostBinding('@page2Animation') public doAnimate = true;
- public exp = true;
- }
+ public exp = true;
+ }
- TestBed.configureTestingModule({
- declarations: [Page1Cmp, Page2Cmp, ContainerCmp],
- imports: [RouterTestingModule.withRoutes([
- {path: 'page1', component: Page1Cmp, data: makeAnimationData('page1')},
- {path: 'page2', component: Page2Cmp, data: makeAnimationData('page2')}
- ])]
- });
+ TestBed.configureTestingModule({
+ declarations: [Page1Cmp, Page2Cmp, ContainerCmp],
+ imports: [RouterTestingModule.withRoutes([
+ {path: 'page1', component: Page1Cmp, data: makeAnimationData('page1')},
+ {path: 'page2', component: Page2Cmp, data: makeAnimationData('page2')}
+ ])]
+ });
- const engine = TestBed.get(ɵAnimationEngine);
- const fixture = TestBed.createComponent(ContainerCmp);
- const cmp = fixture.componentInstance;
- cmp.router.initialNavigation();
- tick();
- fixture.detectChanges();
- engine.flush();
+ const engine = TestBed.get(ɵAnimationEngine);
+ const fixture = TestBed.createComponent(ContainerCmp);
+ const cmp = fixture.componentInstance;
+ cmp.router.initialNavigation();
+ tick();
+ fixture.detectChanges();
+ engine.flush();
- cmp.router.navigateByUrl('/page1');
- tick();
- fixture.detectChanges();
- engine.flush();
+ cmp.router.navigateByUrl('/page1');
+ tick();
+ fixture.detectChanges();
+ engine.flush();
- cmp.router.navigateByUrl('/page2');
- tick();
- fixture.detectChanges();
- engine.flush();
+ cmp.router.navigateByUrl('/page2');
+ tick();
+ fixture.detectChanges();
+ engine.flush();
- const player = engine.players[0] !;
- const groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
- const players = groupPlayer.players as MockAnimationPlayer[];
+ const player = engine.players[0] !;
+ const groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
+ const players = groupPlayer.players as MockAnimationPlayer[];
- expect(players.length).toEqual(2);
- const [p1, p2] = players;
+ expect(players.length).toEqual(2);
+ const [p1, p2] = players;
- expect(p1.keyframes).toEqual([
- {offset: 0, opacity: '0'},
- {offset: 1, opacity: '1'},
- ]);
+ expect(p1.keyframes).toEqual([
+ {offset: 0, opacity: '0'},
+ {offset: 1, opacity: '1'},
+ ]);
- expect(p2.keyframes).toEqual([
- {offset: 0, opacity: '0'},
- {offset: .5, opacity: '0'},
- {offset: 1, opacity: '1'},
- ]);
- }));
+ expect(p2.keyframes).toEqual([
+ {offset: 0, opacity: '0'},
+ {offset: .5, opacity: '0'},
+ {offset: 1, opacity: '1'},
+ ]);
+ }));
- it('should allow inner leave animations to be emulated within a routed item', fakeAsync(() => {
- @Component({
- animations: [
- trigger(
- 'routerAnimations',
- [
- transition(
- 'page1 => page2',
- [
- query(':leave', animateChild()),
- ]),
- ]),
- ],
- template: `
+ fixmeIvy('unknown').it(
+ 'should allow inner leave animations to be emulated within a routed item', fakeAsync(() => {
+ @Component({
+ animations: [
+ trigger(
+ 'routerAnimations',
+ [
+ transition(
+ 'page1 => page2',
+ [
+ query(':leave', animateChild()),
+ ]),
+ ]),
+ ],
+ template: `
`
- })
- class ContainerCmp {
- constructor(public router: Router) {}
+ })
+ class ContainerCmp {
+ constructor(public router: Router) {}
- prepareRouteAnimation(r: RouterOutlet) {
- const animation = r.activatedRouteData['animation'];
- const value = animation ? animation['value'] : null;
- return value;
- }
- }
+ prepareRouteAnimation(r: RouterOutlet) {
+ const animation = r.activatedRouteData['animation'];
+ const value = animation ? animation['value'] : null;
+ return value;
+ }
+ }
- @Component({
- selector: 'page1',
- template: `
+ @Component({
+ selector: 'page1',
+ template: `
Page 1
`,
- animations: [
- trigger(
- 'page1Animation',
- [
- transition(
- ':leave',
- [query('.if-one', animateChild()), query('.if-two', animateChild())]),
- ]),
- trigger(
- 'ifAnimation',
- [transition(':leave', [style({opacity: 1}), animate(1000, style({opacity: 0}))])]),
- ]
- })
- class Page1Cmp {
- @HostBinding('@page1Animation') public doAnimate = true;
+ animations: [
+ trigger(
+ 'page1Animation',
+ [
+ transition(
+ ':leave',
+ [query('.if-one', animateChild()), query('.if-two', animateChild())]),
+ ]),
+ trigger(
+ 'ifAnimation',
+ [transition(
+ ':leave', [style({opacity: 1}), animate(1000, style({opacity: 0}))])]),
+ ]
+ })
+ class Page1Cmp {
+ @HostBinding('@page1Animation') public doAnimate = true;
- public exp = true;
- }
+ public exp = true;
+ }
- @Component({selector: 'page2', template: `page2`, animations: []})
- class Page2Cmp {
- }
+ @Component({selector: 'page2', template: `page2`, animations: []})
+ class Page2Cmp {
+ }
- TestBed.configureTestingModule({
- declarations: [Page1Cmp, Page2Cmp, ContainerCmp],
- imports: [RouterTestingModule.withRoutes([
- {path: 'page1', component: Page1Cmp, data: makeAnimationData('page1')},
- {path: 'page2', component: Page2Cmp, data: makeAnimationData('page2')}
- ])]
- });
+ TestBed.configureTestingModule({
+ declarations: [Page1Cmp, Page2Cmp, ContainerCmp],
+ imports: [RouterTestingModule.withRoutes([
+ {path: 'page1', component: Page1Cmp, data: makeAnimationData('page1')},
+ {path: 'page2', component: Page2Cmp, data: makeAnimationData('page2')}
+ ])]
+ });
- const engine = TestBed.get(ɵAnimationEngine);
- const fixture = TestBed.createComponent(ContainerCmp);
- const cmp = fixture.componentInstance;
- cmp.router.initialNavigation();
- tick();
- fixture.detectChanges();
- engine.flush();
+ const engine = TestBed.get(ɵAnimationEngine);
+ const fixture = TestBed.createComponent(ContainerCmp);
+ const cmp = fixture.componentInstance;
+ cmp.router.initialNavigation();
+ tick();
+ fixture.detectChanges();
+ engine.flush();
- cmp.router.navigateByUrl('/page1');
- tick();
- fixture.detectChanges();
- engine.flush();
+ cmp.router.navigateByUrl('/page1');
+ tick();
+ fixture.detectChanges();
+ engine.flush();
- cmp.router.navigateByUrl('/page2');
- tick();
- fixture.detectChanges();
- engine.flush();
+ cmp.router.navigateByUrl('/page2');
+ tick();
+ fixture.detectChanges();
+ engine.flush();
- const player = engine.players[0] !;
- const groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
- const players = groupPlayer.players as MockAnimationPlayer[];
+ const player = engine.players[0] !;
+ const groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
+ const players = groupPlayer.players as MockAnimationPlayer[];
- expect(players.length).toEqual(2);
- const [p1, p2] = players;
+ expect(players.length).toEqual(2);
+ const [p1, p2] = players;
- expect(p1.keyframes).toEqual([
- {offset: 0, opacity: '1'},
- {offset: 1, opacity: '0'},
- ]);
+ expect(p1.keyframes).toEqual([
+ {offset: 0, opacity: '1'},
+ {offset: 1, opacity: '0'},
+ ]);
- expect(p2.keyframes).toEqual([
- {offset: 0, opacity: '1'},
- {offset: .5, opacity: '1'},
- {offset: 1, opacity: '0'},
- ]);
- }));
+ expect(p2.keyframes).toEqual([
+ {offset: 0, opacity: '1'},
+ {offset: .5, opacity: '1'},
+ {offset: 1, opacity: '0'},
+ ]);
+ }));
- it('should properly collect :enter / :leave router nodes even when another non-router *template component is within the trigger boundaries',
- fakeAsync(() => {
- @Component({
- selector: 'ani-cmp',
- animations: [
- trigger(
- 'pageAnimation',
- [
- transition(
- 'page1 => page2',
- [
- query('.router-container :leave', animate('1s', style({opacity: 0}))),
- query('.router-container :enter', animate('1s', style({opacity: 1}))),
- ]),
- ]),
- ],
- template: `
+ fixmeIvy('unknown').it(
+ 'should properly collect :enter / :leave router nodes even when another non-router *template component is within the trigger boundaries',
+ fakeAsync(() => {
+ @Component({
+ selector: 'ani-cmp',
+ animations: [
+ trigger(
+ 'pageAnimation',
+ [
+ transition(
+ 'page1 => page2',
+ [
+ query('.router-container :leave', animate('1s', style({opacity: 0}))),
+ query('.router-container :enter', animate('1s', style({opacity: 1}))),
+ ]),
+ ]),
+ ],
+ template: `
@@ -388,136 +394,139 @@ import {RouterTestingModule} from '@angular/router/testing';
`
- })
- class ContainerCmp {
- loading = false;
+ })
+ class ContainerCmp {
+ loading = false;
- constructor(public router: Router) {}
+ constructor(public router: Router) {}
- prepRoute(outlet: any) { return outlet.activatedRouteData['animation']; }
- }
+ prepRoute(outlet: any) { return outlet.activatedRouteData['animation']; }
+ }
- @Component({selector: 'page1', template: `page1`})
- class Page1Cmp {
- }
+ @Component({selector: 'page1', template: `page1`})
+ class Page1Cmp {
+ }
- @Component({selector: 'page2', template: `page2`})
- class Page2Cmp {
- }
+ @Component({selector: 'page2', template: `page2`})
+ class Page2Cmp {
+ }
- TestBed.configureTestingModule({
- declarations: [Page1Cmp, Page2Cmp, ContainerCmp],
- imports: [RouterTestingModule.withRoutes([
- {path: 'page1', component: Page1Cmp, data: makeAnimationData('page1')},
- {path: 'page2', component: Page2Cmp, data: makeAnimationData('page2')}
- ])]
- });
+ TestBed.configureTestingModule({
+ declarations: [Page1Cmp, Page2Cmp, ContainerCmp],
+ imports: [RouterTestingModule.withRoutes([
+ {path: 'page1', component: Page1Cmp, data: makeAnimationData('page1')},
+ {path: 'page2', component: Page2Cmp, data: makeAnimationData('page2')}
+ ])]
+ });
- const engine = TestBed.get(ɵAnimationEngine);
- const fixture = TestBed.createComponent(ContainerCmp);
- const cmp = fixture.componentInstance;
- cmp.router.initialNavigation();
- tick();
- fixture.detectChanges();
- engine.flush();
+ const engine = TestBed.get(ɵAnimationEngine);
+ const fixture = TestBed.createComponent(ContainerCmp);
+ const cmp = fixture.componentInstance;
+ cmp.router.initialNavigation();
+ tick();
+ fixture.detectChanges();
+ engine.flush();
- cmp.router.navigateByUrl('/page1');
- tick();
- cmp.loading = true;
- fixture.detectChanges();
- engine.flush();
+ cmp.router.navigateByUrl('/page1');
+ tick();
+ cmp.loading = true;
+ fixture.detectChanges();
+ engine.flush();
- cmp.router.navigateByUrl('/page2');
- tick();
- cmp.loading = false;
- fixture.detectChanges();
- engine.flush();
+ cmp.router.navigateByUrl('/page2');
+ tick();
+ cmp.loading = false;
+ fixture.detectChanges();
+ engine.flush();
- const players = engine.players;
- expect(players.length).toEqual(1);
- const [p1] = players;
+ const players = engine.players;
+ expect(players.length).toEqual(1);
+ const [p1] = players;
- const innerPlayers = p1.getRealPlayer().players;
- expect(innerPlayers.length).toEqual(2);
+ const innerPlayers = p1.getRealPlayer().players;
+ expect(innerPlayers.length).toEqual(2);
- const [ip1, ip2] = innerPlayers;
- expect(ip1.element.innerText).toEqual('page1');
- expect(ip2.element.innerText).toEqual('page2');
- }));
+ const [ip1, ip2] = innerPlayers;
+ expect(ip1.element.innerText).toEqual('page1');
+ expect(ip2.element.innerText).toEqual('page2');
+ }));
- it('should allow a recursive set of :leave animations to occur for nested routes',
- fakeAsync(() => {
- @Component({selector: 'ani-cmp', template: ' '})
- class ContainerCmp {
- constructor(private _router: Router) {}
- log: string[] = [];
+ fixmeIvy('unknown').it(
+ 'should allow a recursive set of :leave animations to occur for nested routes',
+ fakeAsync(() => {
+ @Component(
+ {selector: 'ani-cmp', template: ' '})
+ class ContainerCmp {
+ constructor(private _router: Router) {}
+ log: string[] = [];
- enter() { this._router.navigateByUrl('/(recur:recur/nested)'); }
+ enter() { this._router.navigateByUrl('/(recur:recur/nested)'); }
- leave() { this._router.navigateByUrl('/'); }
- }
+ leave() { this._router.navigateByUrl('/'); }
+ }
- @Component({
- selector: 'recur-page',
- template: 'Depth: {{ depth }} \n ',
- animations: [
- trigger(
- 'pageAnimations',
- [
- transition(':leave', [group([
- sequence([style({opacity: 1}), animate('1s', style({opacity: 0}))]),
- query('@*', animateChild(), {optional: true})
- ])]),
- ]),
- ]
- })
- class RecurPageCmp {
- @HostBinding('@pageAnimations') public animatePage = true;
+ @Component({
+ selector: 'recur-page',
+ template: 'Depth: {{ depth }} \n ',
+ animations: [
+ trigger(
+ 'pageAnimations',
+ [
+ transition(
+ ':leave', [group([
+ sequence([style({opacity: 1}), animate('1s', style({opacity: 0}))]),
+ query('@*', animateChild(), {optional: true})
+ ])]),
+ ]),
+ ]
+ })
+ class RecurPageCmp {
+ @HostBinding('@pageAnimations') public animatePage = true;
- @HostBinding('attr.data-depth') public depth = 0;
+ @HostBinding('attr.data-depth') public depth = 0;
- constructor(private container: ContainerCmp, private route: ActivatedRoute) {
- this.route.data.subscribe(data => {
- this.container.log.push(`DEPTH ${data.depth}`);
- this.depth = data.depth;
- });
- }
- }
+ constructor(private container: ContainerCmp, private route: ActivatedRoute) {
+ this.route.data.subscribe(data => {
+ this.container.log.push(`DEPTH ${data.depth}`);
+ this.depth = data.depth;
+ });
+ }
+ }
- TestBed.configureTestingModule({
- declarations: [ContainerCmp, RecurPageCmp],
- imports: [RouterTestingModule.withRoutes([{
- path: 'recur',
- component: RecurPageCmp,
- outlet: 'recur',
- data: {depth: 0},
- children: [{path: 'nested', component: RecurPageCmp, data: {depth: 1}}]
- }])]
- });
+ TestBed.configureTestingModule({
+ declarations: [ContainerCmp, RecurPageCmp],
+ imports: [RouterTestingModule.withRoutes([{
+ path: 'recur',
+ component: RecurPageCmp,
+ outlet: 'recur',
+ data: {depth: 0},
+ children: [{path: 'nested', component: RecurPageCmp, data: {depth: 1}}]
+ }])]
+ });
- const fixture = TestBed.createComponent(ContainerCmp);
- const cmp = fixture.componentInstance;
- cmp.enter();
- tick();
- fixture.detectChanges();
- flushMicrotasks();
+ const fixture = TestBed.createComponent(ContainerCmp);
+ const cmp = fixture.componentInstance;
+ cmp.enter();
+ tick();
+ fixture.detectChanges();
+ flushMicrotasks();
- expect(cmp.log).toEqual([
- 'DEPTH 0',
- 'DEPTH 1',
- ]);
+ expect(cmp.log).toEqual([
+ 'DEPTH 0',
+ 'DEPTH 1',
+ ]);
- cmp.leave();
- tick();
- fixture.detectChanges();
+ cmp.leave();
+ tick();
+ fixture.detectChanges();
- const players = getLog();
- expect(players.length).toEqual(2);
+ const players = getLog();
+ expect(players.length).toEqual(2);
- const [p1, p2] = players;
- expect(p1.element.getAttribute('data-depth')).toEqual('0');
- expect(p2.element.getAttribute('data-depth')).toEqual('1');
- }));
+ const [p1, p2] = players;
+ expect(p1.element.getAttribute('data-depth')).toEqual('0');
+ expect(p2.element.getAttribute('data-depth')).toEqual('1');
+ }));
});
});
diff --git a/packages/core/test/animation/animations_with_web_animations_integration_spec.ts b/packages/core/test/animation/animations_with_web_animations_integration_spec.ts
index 53bdd3cd59..7b2ec1ec2a 100644
--- a/packages/core/test/animation/animations_with_web_animations_integration_spec.ts
+++ b/packages/core/test/animation/animations_with_web_animations_integration_spec.ts
@@ -5,15 +5,15 @@
* 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 {animate, group, query, state, style, transition, trigger} from '@angular/animations';
+import {animate, query, state, style, transition, trigger} from '@angular/animations';
import {AnimationDriver, ɵAnimationEngine, ɵWebAnimationsDriver, ɵWebAnimationsPlayer, ɵsupportsWebAnimations} from '@angular/animations/browser';
import {TransitionAnimationPlayer} from '@angular/animations/browser/src/render/transition_animation_engine';
import {AnimationGroupPlayer} from '@angular/animations/src/players/animation_group_player';
import {Component} from '@angular/core';
+import {TestBed} from '@angular/core/testing';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {browserDetection} from '@angular/platform-browser/testing/src/browser_util';
-
-import {TestBed} from '../../testing';
+import {fixmeIvy} from '@angular/private/testing';
(function() {
// these tests are only mean't to be run within the DOM (for now)
@@ -242,9 +242,10 @@ import {TestBed} from '../../testing';
]);
});
- it('should treat * styles as ! for queried items that are collected in a container that is being removed',
- () => {
- @Component({
+ fixmeIvy('unknown').it(
+ 'should treat * styles as ! for queried items that are collected in a container that is being removed',
+ () => {
+ @Component({
selector: 'my-app',
styles: [`
.list .outer {
@@ -285,58 +286,58 @@ import {TestBed} from '../../testing';
]
})
class Cmp {
- items: any[] = [];
+ items: any[] = [];
- get exp() { return this.items.length ? 'full' : 'empty'; }
+ get exp() { return this.items.length ? 'full' : 'empty'; }
- empty() { this.items = []; }
+ empty() { this.items = []; }
- full() { this.items = [0, 1, 2, 3, 4]; }
- }
+ full() { this.items = [0, 1, 2, 3, 4]; }
+ }
- TestBed.configureTestingModule({declarations: [Cmp]});
+ TestBed.configureTestingModule({declarations: [Cmp]});
- const engine = TestBed.get(ɵAnimationEngine);
- const fixture = TestBed.createComponent(Cmp);
- const cmp = fixture.componentInstance;
+ const engine = TestBed.get(ɵAnimationEngine);
+ const fixture = TestBed.createComponent(Cmp);
+ const cmp = fixture.componentInstance;
- cmp.empty();
- fixture.detectChanges();
- let player = engine.players[0] !as TransitionAnimationPlayer;
- player.finish();
+ cmp.empty();
+ fixture.detectChanges();
+ let player = engine.players[0] !as TransitionAnimationPlayer;
+ player.finish();
- cmp.full();
- fixture.detectChanges();
+ cmp.full();
+ fixture.detectChanges();
- player = engine.players[0] !as TransitionAnimationPlayer;
- let queriedPlayers = (player.getRealPlayer() as AnimationGroupPlayer).players;
- expect(queriedPlayers.length).toEqual(5);
+ player = engine.players[0] !as TransitionAnimationPlayer;
+ let queriedPlayers = (player.getRealPlayer() as AnimationGroupPlayer).players;
+ expect(queriedPlayers.length).toEqual(5);
- let i = 0;
- for (i = 0; i < queriedPlayers.length; i++) {
- let player = queriedPlayers[i] as ɵWebAnimationsPlayer;
- expect(player.keyframes).toEqual([
- {height: '0px', offset: 0},
- {height: '50px', offset: 1},
- ]);
- player.finish();
- }
+ let i = 0;
+ for (i = 0; i < queriedPlayers.length; i++) {
+ let player = queriedPlayers[i] as ɵWebAnimationsPlayer;
+ expect(player.keyframes).toEqual([
+ {height: '0px', offset: 0},
+ {height: '50px', offset: 1},
+ ]);
+ player.finish();
+ }
- cmp.empty();
- fixture.detectChanges();
+ cmp.empty();
+ fixture.detectChanges();
- player = engine.players[0] !as TransitionAnimationPlayer;
- queriedPlayers = (player.getRealPlayer() as AnimationGroupPlayer).players;
- expect(queriedPlayers.length).toEqual(5);
+ player = engine.players[0] !as TransitionAnimationPlayer;
+ queriedPlayers = (player.getRealPlayer() as AnimationGroupPlayer).players;
+ expect(queriedPlayers.length).toEqual(5);
- for (i = 0; i < queriedPlayers.length; i++) {
- let player = queriedPlayers[i] as ɵWebAnimationsPlayer;
- expect(player.keyframes).toEqual([
- {height: '50px', offset: 0},
- {height: '0px', offset: 1},
- ]);
- }
- });
+ for (i = 0; i < queriedPlayers.length; i++) {
+ let player = queriedPlayers[i] as ɵWebAnimationsPlayer;
+ expect(player.keyframes).toEqual([
+ {height: '50px', offset: 0},
+ {height: '0px', offset: 1},
+ ]);
+ }
+ });
it('should compute intermediate styles properly when an animation is cancelled', () => {
@Component({
diff --git a/packages/core/test/linker/change_detection_integration_spec.ts b/packages/core/test/linker/change_detection_integration_spec.ts
index 2a4f42deb4..8bded58d0f 100644
--- a/packages/core/test/linker/change_detection_integration_spec.ts
+++ b/packages/core/test/linker/change_detection_integration_spec.ts
@@ -13,6 +13,7 @@ import {ComponentFixture, TestBed, fakeAsync} from '@angular/core/testing';
import {By} from '@angular/platform-browser/src/dom/debug/by';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {expect} from '@angular/platform-browser/testing/src/matchers';
+import {fixmeIvy} from '@angular/private/testing';
export function createUrlResolverWithoutPackagePrefix(): UrlResolver {
return new UrlResolver();
@@ -445,13 +446,14 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
}));
- it('should ignore empty bindings', fakeAsync(() => {
- const ctx = _bindSimpleProp('[someProp]', TestData);
- ctx.componentInstance.a = 'value';
- ctx.detectChanges(false);
+ fixmeIvy('FW-814: Bindings with an empty value should be ignored in the compiler')
+ .it('should ignore empty bindings', fakeAsync(() => {
+ const ctx = _bindSimpleProp('[someProp]', TestData);
+ ctx.componentInstance.a = 'value';
+ ctx.detectChanges(false);
- expect(renderLog.log).toEqual([]);
- }));
+ expect(renderLog.log).toEqual([]);
+ }));
it('should support interpolation', fakeAsync(() => {
const ctx = _bindSimpleProp('someProp="B{{a}}A"', TestData);
@@ -537,27 +539,28 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
expect(renderLog.log).toEqual(['someProp=Megatron']);
}));
- it('should record unwrapped values via ngOnChanges', fakeAsync(() => {
- const ctx = createCompFixture(
- '
');
- const dir: TestDirective = queryDirs(ctx.debugElement, TestDirective)[0];
- ctx.detectChanges(false);
- dir.changes = {};
- ctx.detectChanges(false);
+ fixmeIvy('unknown').it(
+ 'should record unwrapped values via ngOnChanges', fakeAsync(() => {
+ const ctx = createCompFixture(
+ '
');
+ const dir: TestDirective = queryDirs(ctx.debugElement, TestDirective)[0];
+ ctx.detectChanges(false);
+ dir.changes = {};
+ ctx.detectChanges(false);
- // Note: the binding for `b` did not change and has no ValueWrapper,
- // and should therefore stay unchanged.
- expect(dir.changes).toEqual({
- 'name': new SimpleChange('aName', 'aName', false),
- 'b': new SimpleChange(2, 2, false)
- });
+ // Note: the binding for `b` did not change and has no ValueWrapper,
+ // and should therefore stay unchanged.
+ expect(dir.changes).toEqual({
+ 'name': new SimpleChange('aName', 'aName', false),
+ 'b': new SimpleChange(2, 2, false)
+ });
- ctx.detectChanges(false);
- expect(dir.changes).toEqual({
- 'name': new SimpleChange('aName', 'aName', false),
- 'b': new SimpleChange(2, 2, false)
- });
- }));
+ ctx.detectChanges(false);
+ expect(dir.changes).toEqual({
+ 'name': new SimpleChange('aName', 'aName', false),
+ 'b': new SimpleChange(2, 2, false)
+ });
+ }));
it('should call pure pipes only if the arguments change', fakeAsync(() => {
const ctx = _bindSimpleValue('name | countingPipe', Person);
@@ -588,29 +591,30 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
}));
- it('should call pure pipes that are used multiple times only when the arguments change',
- fakeAsync(() => {
- const ctx = createCompFixture(
- `
` +
- '
',
- Person);
- ctx.componentInstance.name = 'a';
- ctx.componentInstance.age = 10;
- ctx.componentInstance.address = new Address('mtv');
- ctx.detectChanges(false);
- expect(renderLog.loggedValues).toEqual([
- 'mtv state:0', 'mtv state:1', 'a state:2', '10 state:3'
- ]);
- ctx.detectChanges(false);
- expect(renderLog.loggedValues).toEqual([
- 'mtv state:0', 'mtv state:1', 'a state:2', '10 state:3'
- ]);
- ctx.componentInstance.age = 11;
- ctx.detectChanges(false);
- expect(renderLog.loggedValues).toEqual([
- 'mtv state:0', 'mtv state:1', 'a state:2', '10 state:3', '11 state:4'
- ]);
- }));
+ fixmeIvy('unknown').it(
+ 'should call pure pipes that are used multiple times only when the arguments change',
+ fakeAsync(() => {
+ const ctx = createCompFixture(
+ `
` +
+ '
',
+ Person);
+ ctx.componentInstance.name = 'a';
+ ctx.componentInstance.age = 10;
+ ctx.componentInstance.address = new Address('mtv');
+ ctx.detectChanges(false);
+ expect(renderLog.loggedValues).toEqual([
+ 'mtv state:0', 'mtv state:1', 'a state:2', '10 state:3'
+ ]);
+ ctx.detectChanges(false);
+ expect(renderLog.loggedValues).toEqual([
+ 'mtv state:0', 'mtv state:1', 'a state:2', '10 state:3'
+ ]);
+ ctx.componentInstance.age = 11;
+ ctx.detectChanges(false);
+ expect(renderLog.loggedValues).toEqual([
+ 'mtv state:0', 'mtv state:1', 'a state:2', '10 state:3', '11 state:4'
+ ]);
+ }));
it('should call impure pipes on each change detection run', fakeAsync(() => {
const ctx = _bindSimpleValue('name | countingImpurePipe', Person);
@@ -994,31 +998,32 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
expect(directiveLog.filter(['ngAfterViewInit'])).toEqual([]);
}));
- it('should not call ngAfterViewInit again if it throws', fakeAsync(() => {
- const ctx =
- createCompFixture('
');
+ fixmeIvy('unknown').it(
+ 'should not call ngAfterViewInit again if it throws', fakeAsync(() => {
+ const ctx =
+ createCompFixture('
');
- let errored = false;
- // First pass fails, but ngAfterViewInit should be called.
- try {
- ctx.detectChanges(false);
- } catch (e) {
- errored = true;
- }
- expect(errored).toBe(true);
+ let errored = false;
+ // First pass fails, but ngAfterViewInit should be called.
+ try {
+ ctx.detectChanges(false);
+ } catch (e) {
+ errored = true;
+ }
+ expect(errored).toBe(true);
- expect(directiveLog.filter(['ngAfterViewInit'])).toEqual(['dir.ngAfterViewInit']);
- directiveLog.clear();
+ expect(directiveLog.filter(['ngAfterViewInit'])).toEqual(['dir.ngAfterViewInit']);
+ directiveLog.clear();
- // Second change detection also fails, but this time ngAfterViewInit should not be
- // called.
- try {
- ctx.detectChanges(false);
- } catch (e) {
- throw new Error('Second detectChanges() should not have run detection.');
- }
- expect(directiveLog.filter(['ngAfterViewInit'])).toEqual([]);
- }));
+ // Second change detection also fails, but this time ngAfterViewInit should not be
+ // called.
+ try {
+ ctx.detectChanges(false);
+ } catch (e) {
+ throw new Error('Second detectChanges() should not have run detection.');
+ }
+ expect(directiveLog.filter(['ngAfterViewInit'])).toEqual([]);
+ }));
});
describe('ngAfterViewChecked', () => {
@@ -1073,111 +1078,119 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
});
describe('ngOnDestroy', () => {
- it('should be called on view destruction', fakeAsync(() => {
- const ctx = createCompFixture('
');
- ctx.detectChanges(false);
+ fixmeIvy('unknown').it(
+ 'should be called on view destruction', fakeAsync(() => {
+ const ctx = createCompFixture('
');
+ ctx.detectChanges(false);
- ctx.destroy();
+ ctx.destroy();
- expect(directiveLog.filter(['ngOnDestroy'])).toEqual(['dir.ngOnDestroy']);
- }));
+ expect(directiveLog.filter(['ngOnDestroy'])).toEqual(['dir.ngOnDestroy']);
+ }));
- it('should be called after processing the content and view children', fakeAsync(() => {
- TestBed.overrideComponent(AnotherComponent, {
- set: new Component(
- {selector: 'other-cmp', template: '
'})
- });
+ fixmeIvy('unknown').it(
+ 'should be called after processing the content and view children', fakeAsync(() => {
+ TestBed.overrideComponent(AnotherComponent, {
+ set: new Component(
+ {selector: 'other-cmp', template: '
'})
+ });
- const ctx = createCompFixture(
- '',
- TestComponent);
+ const ctx = createCompFixture(
+ '',
+ TestComponent);
- ctx.detectChanges(false);
- ctx.destroy();
+ ctx.detectChanges(false);
+ ctx.destroy();
- expect(directiveLog.filter(['ngOnDestroy'])).toEqual([
- 'contentChild0.ngOnDestroy', 'contentChild1.ngOnDestroy', 'viewChild.ngOnDestroy',
- 'parent.ngOnDestroy'
- ]);
- }));
+ expect(directiveLog.filter(['ngOnDestroy'])).toEqual([
+ 'contentChild0.ngOnDestroy', 'contentChild1.ngOnDestroy', 'viewChild.ngOnDestroy',
+ 'parent.ngOnDestroy'
+ ]);
+ }));
- it('should be called in reverse order so the child is always notified before the parent',
- fakeAsync(() => {
- const ctx = createCompFixture(
- '
');
+ fixmeIvy('unknown').it(
+ 'should be called in reverse order so the child is always notified before the parent',
+ fakeAsync(() => {
+ const ctx = createCompFixture(
+ '
');
- ctx.detectChanges(false);
- ctx.destroy();
+ ctx.detectChanges(false);
+ ctx.destroy();
- expect(directiveLog.filter(['ngOnDestroy'])).toEqual([
- 'child.ngOnDestroy', 'parent.ngOnDestroy', 'sibling.ngOnDestroy'
- ]);
- }));
+ expect(directiveLog.filter(['ngOnDestroy'])).toEqual([
+ 'child.ngOnDestroy', 'parent.ngOnDestroy', 'sibling.ngOnDestroy'
+ ]);
+ }));
- it('should deliver synchronous events to parent', fakeAsync(() => {
- const ctx = createCompFixture('
');
+ fixmeIvy('unknown').it(
+ 'should deliver synchronous events to parent', fakeAsync(() => {
+ const ctx = createCompFixture('
');
- ctx.detectChanges(false);
- ctx.destroy();
+ ctx.detectChanges(false);
+ ctx.destroy();
- expect(ctx.componentInstance.a).toEqual('destroyed');
- }));
+ expect(ctx.componentInstance.a).toEqual('destroyed');
+ }));
- it('should call ngOnDestroy on pipes', fakeAsync(() => {
- const ctx = createCompFixture('{{true | pipeWithOnDestroy }}');
+ fixmeIvy('unknown').it('should call ngOnDestroy on pipes', fakeAsync(() => {
+ const ctx = createCompFixture('{{true | pipeWithOnDestroy }}');
- ctx.detectChanges(false);
- ctx.destroy();
+ ctx.detectChanges(false);
+ ctx.destroy();
- expect(directiveLog.filter(['ngOnDestroy'])).toEqual([
- 'pipeWithOnDestroy.ngOnDestroy'
- ]);
- }));
+ expect(directiveLog.filter(['ngOnDestroy'])).toEqual([
+ 'pipeWithOnDestroy.ngOnDestroy'
+ ]);
+ }));
- it('should call ngOnDestroy on an injectable class', fakeAsync(() => {
- TestBed.overrideDirective(
- TestDirective, {set: {providers: [InjectableWithLifecycle]}});
+ fixmeIvy('unknown').it('should call ngOnDestroy on an injectable class', fakeAsync(() => {
+ TestBed.overrideDirective(
+ TestDirective, {set: {providers: [InjectableWithLifecycle]}});
- const ctx = createCompFixture('
', TestComponent);
+ const ctx = createCompFixture(
+ '
', TestComponent);
- ctx.debugElement.children[0].injector.get(InjectableWithLifecycle);
- ctx.detectChanges(false);
+ ctx.debugElement.children[0].injector.get(InjectableWithLifecycle);
+ ctx.detectChanges(false);
- ctx.destroy();
+ ctx.destroy();
- // We don't care about the exact order in this test.
- expect(directiveLog.filter(['ngOnDestroy']).sort()).toEqual([
- 'dir.ngOnDestroy', 'injectable.ngOnDestroy'
- ]);
- }));
+ // We don't care about the exact order in this test.
+ expect(directiveLog.filter(['ngOnDestroy']).sort()).toEqual([
+ 'dir.ngOnDestroy', 'injectable.ngOnDestroy'
+ ]);
+ }));
});
});
describe('enforce no new changes', () => {
- it('should throw when a record gets changed after it has been checked', fakeAsync(() => {
- @Directive({selector: '[changed]'})
- class ChangingDirective {
- @Input() changed: any;
- }
+ fixmeIvy('unknown').it(
+ 'should throw when a record gets changed after it has been checked', fakeAsync(() => {
+ @Directive({selector: '[changed]'})
+ class ChangingDirective {
+ @Input() changed: any;
+ }
- TestBed.configureTestingModule({declarations: [ChangingDirective]});
+ TestBed.configureTestingModule({declarations: [ChangingDirective]});
- const ctx = createCompFixture('
', TestData);
+ const ctx = createCompFixture('
', TestData);
- ctx.componentInstance.b = 1;
+ ctx.componentInstance.b = 1;
- expect(() => ctx.checkNoChanges())
- .toThrowError(/Previous value: 'changed: undefined'\. Current value: 'changed: 1'/g);
- }));
+ expect(() => ctx.checkNoChanges())
+ .toThrowError(
+ /Previous value: 'changed: undefined'\. Current value: 'changed: 1'/g);
+ }));
- it('should warn when the view has been created in a cd hook', fakeAsync(() => {
- const ctx = createCompFixture('{{ a }}
', TestData);
- ctx.componentInstance.a = 1;
- expect(() => ctx.detectChanges())
- .toThrowError(
- /It seems like the view has been created after its parent and its children have been dirty checked/);
- }));
+ fixmeIvy('unknown').it(
+ 'should warn when the view has been created in a cd hook', fakeAsync(() => {
+ const ctx = createCompFixture('{{ a }}
', TestData);
+ ctx.componentInstance.a = 1;
+ expect(() => ctx.detectChanges())
+ .toThrowError(
+ /It seems like the view has been created after its parent and its children have been dirty checked/);
+ }));
it('should not throw when two arrays are structurally the same', fakeAsync(() => {
const ctx = _bindSimpleValue('a', TestData);
@@ -1187,27 +1200,27 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
expect(() => ctx.checkNoChanges()).not.toThrow();
}));
- it('should not break the next run', fakeAsync(() => {
- const ctx = _bindSimpleValue('a', TestData);
- ctx.componentInstance.a = 'value';
- expect(() => ctx.checkNoChanges()).toThrow();
+ fixmeIvy('unknown').it('should not break the next run', fakeAsync(() => {
+ const ctx = _bindSimpleValue('a', TestData);
+ ctx.componentInstance.a = 'value';
+ expect(() => ctx.checkNoChanges()).toThrow();
- ctx.detectChanges();
- expect(renderLog.loggedValues).toEqual(['value']);
- }));
+ ctx.detectChanges();
+ expect(renderLog.loggedValues).toEqual(['value']);
+ }));
});
describe('mode', () => {
- it('Detached', fakeAsync(() => {
- const ctx = createCompFixture(' ');
- const cmp: CompWithRef = queryDirs(ctx.debugElement, CompWithRef)[0];
- cmp.value = 'hello';
- cmp.changeDetectorRef.detach();
+ fixmeIvy('unknown').it('Detached', fakeAsync(() => {
+ const ctx = createCompFixture(' ');
+ const cmp: CompWithRef = queryDirs(ctx.debugElement, CompWithRef)[0];
+ cmp.value = 'hello';
+ cmp.changeDetectorRef.detach();
- ctx.detectChanges();
+ ctx.detectChanges();
- expect(renderLog.log).toEqual([]);
- }));
+ expect(renderLog.log).toEqual([]);
+ }));
it('Detached should disable OnPush', fakeAsync(() => {
const ctx = createCompFixture(' ');
@@ -1260,34 +1273,36 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
}));
- it('Reattaches in the original cd mode', fakeAsync(() => {
- const ctx = createCompFixture(' ');
- const cmp: PushComp = queryDirs(ctx.debugElement, PushComp)[0];
- cmp.changeDetectorRef.detach();
- cmp.changeDetectorRef.reattach();
+ fixmeIvy('unknown').it('Reattaches in the original cd mode', fakeAsync(() => {
+ const ctx = createCompFixture(' ');
+ const cmp: PushComp = queryDirs(ctx.debugElement, PushComp)[0];
+ cmp.changeDetectorRef.detach();
+ cmp.changeDetectorRef.reattach();
- // renderCount should NOT be incremented with each CD as CD mode should be resetted to
- // on-push
- ctx.detectChanges();
- expect(cmp.renderCount).toBeGreaterThan(0);
- const count = cmp.renderCount;
+ // renderCount should NOT be incremented with each CD as CD mode
+ // should be resetted to
+ // on-push
+ ctx.detectChanges();
+ expect(cmp.renderCount).toBeGreaterThan(0);
+ const count = cmp.renderCount;
- ctx.detectChanges();
- expect(cmp.renderCount).toBe(count);
- }));
+ ctx.detectChanges();
+ expect(cmp.renderCount).toBe(count);
+ }));
});
describe('multi directive order', () => {
- it('should follow the DI order for the same element', fakeAsync(() => {
- const ctx =
- createCompFixture('
');
+ fixmeIvy('unknown').it(
+ 'should follow the DI order for the same element', fakeAsync(() => {
+ const ctx =
+ createCompFixture('
');
- ctx.detectChanges(false);
- ctx.destroy();
+ ctx.detectChanges(false);
+ ctx.destroy();
- expect(directiveLog.filter(['set'])).toEqual(['0.set', '1.set', '2.set']);
- }));
+ expect(directiveLog.filter(['set'])).toEqual(['0.set', '1.set', '2.set']);
+ }));
});
describe('nested view recursion', () => {
@@ -1424,25 +1439,26 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
expect(log).toEqual(['inner-start', 'main-tpl', 'outer-tpl']);
});
- it('should dirty check projected views if the declaration place is dirty checked', () => {
- ctx.detectChanges(false);
- log = [];
- innerComp.cdRef.detach();
- mainComp.cdRef.detectChanges();
+ fixmeIvy('unknown').it(
+ 'should dirty check projected views if the declaration place is dirty checked', () => {
+ ctx.detectChanges(false);
+ log = [];
+ innerComp.cdRef.detach();
+ mainComp.cdRef.detectChanges();
- expect(log).toEqual(['main-start', 'outer-start', 'main-tpl', 'outer-tpl']);
+ expect(log).toEqual(['main-start', 'outer-start', 'main-tpl', 'outer-tpl']);
- log = [];
- outerComp.cdRef.detectChanges();
+ log = [];
+ outerComp.cdRef.detectChanges();
- expect(log).toEqual(['outer-start', 'outer-tpl']);
+ expect(log).toEqual(['outer-start', 'outer-tpl']);
- log = [];
- outerComp.cdRef.detach();
- mainComp.cdRef.detectChanges();
+ log = [];
+ outerComp.cdRef.detach();
+ mainComp.cdRef.detectChanges();
- expect(log).toEqual(['main-start', 'main-tpl']);
- });
+ expect(log).toEqual(['main-start', 'main-tpl']);
+ });
});
});
@@ -1516,7 +1532,7 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
childThrows: LifetimeMethods;
}
- describe('calling init', () => {
+ fixmeIvy('unknown').describe('calling init', () => {
function initialize(options: Options) {
@Component({selector: 'my-child', template: ''})
class MyChild {
diff --git a/packages/core/test/linker/integration_spec.ts b/packages/core/test/linker/integration_spec.ts
index 63a7186d81..079bb2132b 100644
--- a/packages/core/test/linker/integration_spec.ts
+++ b/packages/core/test/linker/integration_spec.ts
@@ -700,30 +700,31 @@ function declareTests(config?: {useJit: boolean}) {
});
if (getDOM().supportsDOMEvents()) {
- it('should be checked when an async pipe requests a check', fakeAsync(() => {
- TestBed.configureTestingModule(
- {declarations: [MyComp, PushCmpWithAsyncPipe], imports: [CommonModule]});
- const template = ' ';
- TestBed.overrideComponent(MyComp, {set: {template}});
- const fixture = TestBed.createComponent(MyComp);
+ fixmeIvy('unknown').it(
+ 'should be checked when an async pipe requests a check', fakeAsync(() => {
+ TestBed.configureTestingModule(
+ {declarations: [MyComp, PushCmpWithAsyncPipe], imports: [CommonModule]});
+ const template = ' ';
+ TestBed.overrideComponent(MyComp, {set: {template}});
+ const fixture = TestBed.createComponent(MyComp);
- tick();
+ tick();
- const cmp: PushCmpWithAsyncPipe =
- fixture.debugElement.children[0].references !['cmp'];
- fixture.detectChanges();
- expect(cmp.numberOfChecks).toEqual(1);
+ const cmp: PushCmpWithAsyncPipe =
+ fixture.debugElement.children[0].references !['cmp'];
+ fixture.detectChanges();
+ expect(cmp.numberOfChecks).toEqual(1);
- fixture.detectChanges();
- fixture.detectChanges();
- expect(cmp.numberOfChecks).toEqual(1);
+ fixture.detectChanges();
+ fixture.detectChanges();
+ expect(cmp.numberOfChecks).toEqual(1);
- cmp.resolve(2);
- tick();
+ cmp.resolve(2);
+ tick();
- fixture.detectChanges();
- expect(cmp.numberOfChecks).toEqual(2);
- }));
+ fixture.detectChanges();
+ expect(cmp.numberOfChecks).toEqual(2);
+ }));
}
});
@@ -1872,7 +1873,7 @@ function declareTests(config?: {useJit: boolean}) {
if (getDOM().supportsDOMEvents()) {
describe('svg', () => {
- it('should support svg elements', () => {
+ fixmeIvy('unknown').it('should support svg elements', () => {
TestBed.configureTestingModule({declarations: [MyComp]});
const template = ' ';
TestBed.overrideComponent(MyComp, {set: {template}});
@@ -1891,7 +1892,7 @@ function declareTests(config?: {useJit: boolean}) {
expect(firstAttribute.namespaceURI).toEqual('http://www.w3.org/1999/xlink');
});
- it('should support foreignObjects with document fragments', () => {
+ fixmeIvy('unknown').it('should support foreignObjects with document fragments', () => {
TestBed.configureTestingModule({declarations: [MyComp]});
const template =
'Test
';
@@ -1913,7 +1914,7 @@ function declareTests(config?: {useJit: boolean}) {
describe('attributes', () => {
- it('should support attributes with namespace', () => {
+ fixmeIvy('unknown').it('should support attributes with namespace', () => {
TestBed.configureTestingModule({declarations: [MyComp, SomeCmp]});
const template = ' ';
TestBed.overrideComponent(SomeCmp, {set: {template}});
@@ -1924,7 +1925,7 @@ function declareTests(config?: {useJit: boolean}) {
.toEqual('#id');
});
- it('should support binding to attributes with namespace', () => {
+ fixmeIvy('unknown').it('should support binding to attributes with namespace', () => {
TestBed.configureTestingModule({declarations: [MyComp, SomeCmp]});
const template = ' ';
TestBed.overrideComponent(SomeCmp, {set: {template}});
diff --git a/packages/core/test/linker/projection_integration_spec.ts b/packages/core/test/linker/projection_integration_spec.ts
index 534c24e5d7..8e6f0f0bdc 100644
--- a/packages/core/test/linker/projection_integration_spec.ts
+++ b/packages/core/test/linker/projection_integration_spec.ts
@@ -370,21 +370,22 @@ describe('projection', () => {
});
if (getDOM().supportsNativeShadowDOM()) {
- it('should support native content projection and isolate styles per component', () => {
- TestBed.configureTestingModule({declarations: [SimpleNative1, SimpleNative2]});
- TestBed.overrideComponent(MainComp, {
- set: {
- template: 'A
' +
- 'B
'
- }
- });
- const main = TestBed.createComponent(MainComp);
+ fixmeIvy('unknown').it(
+ 'should support native content projection and isolate styles per component', () => {
+ TestBed.configureTestingModule({declarations: [SimpleNative1, SimpleNative2]});
+ TestBed.overrideComponent(MainComp, {
+ set: {
+ template: 'A
' +
+ 'B
'
+ }
+ });
+ const main = TestBed.createComponent(MainComp);
- const childNodes = getDOM().childNodes(main.nativeElement);
- expect(childNodes[0]).toHaveText('div {color: red}SIMPLE1(A)');
- expect(childNodes[1]).toHaveText('div {color: blue}SIMPLE2(B)');
- main.destroy();
- });
+ const childNodes = getDOM().childNodes(main.nativeElement);
+ expect(childNodes[0]).toHaveText('div {color: red}SIMPLE1(A)');
+ expect(childNodes[1]).toHaveText('div {color: blue}SIMPLE2(B)');
+ main.destroy();
+ });
}
if (getDOM().supportsDOMEvents()) {
diff --git a/packages/core/test/linker/regression_integration_spec.ts b/packages/core/test/linker/regression_integration_spec.ts
index 02f5fa71be..92f79c131c 100644
--- a/packages/core/test/linker/regression_integration_spec.ts
+++ b/packages/core/test/linker/regression_integration_spec.ts
@@ -428,7 +428,7 @@ function declareTestsUsingBootstrap() {
if (getDOM().supportsDOMEvents()) {
// This test needs a real DOM....
- it('should keep change detecting if there was an error', (done) => {
+ fixmeIvy('unknown').it('should keep change detecting if there was an error', (done) => {
@Component({
selector: COMP_SELECTOR,
template:
diff --git a/packages/core/test/linker/view_injector_integration_spec.ts b/packages/core/test/linker/view_injector_integration_spec.ts
index f957b03656..f58ea53887 100644
--- a/packages/core/test/linker/view_injector_integration_spec.ts
+++ b/packages/core/test/linker/view_injector_integration_spec.ts
@@ -10,6 +10,7 @@ import {Attribute, ChangeDetectionStrategy, ChangeDetectorRef, Component, Compon
import {ComponentFixture, TestBed, fakeAsync} from '@angular/core/testing';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {expect} from '@angular/platform-browser/testing/src/matchers';
+import {fixmeIvy} from '@angular/private/testing';
@Directive({selector: '[simpleDirective]'})
class SimpleDirective {
@@ -291,7 +292,7 @@ class TestComp {
expect(el.children[0].injector.get('injectable2')).toEqual('injectable1-injectable2');
});
- it('should instantiate viewProviders that have dependencies', () => {
+ fixmeIvy('unknown').it('should instantiate viewProviders that have dependencies', () => {
TestBed.configureTestingModule({declarations: [SimpleComponent]});
const viewProviders = [
{provide: 'injectable1', useValue: 'injectable1'}, {
@@ -428,7 +429,7 @@ class TestComp {
expect(ctx.debugElement.injector.get('eager2')).toBe('v2: v1');
});
- it('should inject providers that were declared after it', () => {
+ fixmeIvy('unknown').it('should inject providers that were declared after it', () => {
@Component({
template: '',
providers: [
@@ -464,7 +465,7 @@ class TestComp {
expect(comp.componentInstance.a).toBe('aValue');
});
- it('should support ngOnDestroy for lazy providers', () => {
+ fixmeIvy('unknown').it('should support ngOnDestroy for lazy providers', () => {
let created = false;
let destroyed = false;
@@ -496,7 +497,7 @@ class TestComp {
expect(destroyed).toBe(true);
});
- it('should instantiate view providers lazily', () => {
+ fixmeIvy('unknown').it('should instantiate view providers lazily', () => {
let created = false;
TestBed.configureTestingModule({declarations: [SimpleComponent]});
TestBed.overrideComponent(
@@ -551,38 +552,45 @@ class TestComp {
.toEqual('parentService');
});
- it('should instantiate directives that depend on providers of a component', () => {
- TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
- TestBed.overrideComponent(
- SimpleComponent, {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
- TestBed.overrideComponent(SimpleComponent, {set: {template: '
'}});
- const el = createComponent('
');
- expect(el.children[0].children[0].injector.get(NeedsService).service)
- .toEqual('hostService');
- });
+ fixmeIvy('unknown').it(
+ 'should instantiate directives that depend on providers of a component', () => {
+ TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
+ TestBed.overrideComponent(
+ SimpleComponent,
+ {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
+ TestBed.overrideComponent(
+ SimpleComponent, {set: {template: '
'}});
+ const el = createComponent('
');
+ expect(el.children[0].children[0].injector.get(NeedsService).service)
+ .toEqual('hostService');
+ });
- it('should instantiate directives that depend on view providers of a component', () => {
- TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
- TestBed.overrideComponent(
- SimpleComponent, {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
- TestBed.overrideComponent(SimpleComponent, {set: {template: '
'}});
- const el = createComponent('
');
- expect(el.children[0].children[0].injector.get(NeedsService).service)
- .toEqual('hostService');
- });
+ fixmeIvy('unknown').it(
+ 'should instantiate directives that depend on view providers of a component', () => {
+ TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
+ TestBed.overrideComponent(
+ SimpleComponent,
+ {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
+ TestBed.overrideComponent(
+ SimpleComponent, {set: {template: '
'}});
+ const el = createComponent('
');
+ expect(el.children[0].children[0].injector.get(NeedsService).service)
+ .toEqual('hostService');
+ });
- it('should instantiate directives in a root embedded view that depend on view providers of a component',
- () => {
- TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
- TestBed.overrideComponent(
- SimpleComponent,
- {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
- TestBed.overrideComponent(
- SimpleComponent, {set: {template: '
'}});
- const el = createComponent('
');
- expect(el.children[0].children[0].injector.get(NeedsService).service)
- .toEqual('hostService');
- });
+ fixmeIvy('unknown').it(
+ 'should instantiate directives in a root embedded view that depend on view providers of a component',
+ () => {
+ TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
+ TestBed.overrideComponent(
+ SimpleComponent,
+ {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
+ TestBed.overrideComponent(
+ SimpleComponent, {set: {template: '
'}});
+ const el = createComponent('
');
+ expect(el.children[0].children[0].injector.get(NeedsService).service)
+ .toEqual('hostService');
+ });
it('should instantiate directives that depend on instances in the app injector', () => {
TestBed.configureTestingModule({declarations: [NeedsAppService]});
@@ -590,54 +598,57 @@ class TestComp {
expect(el.children[0].injector.get(NeedsAppService).service).toEqual('appService');
});
- it('should not instantiate a directive with cyclic dependencies', () => {
+ fixmeIvy('unknown').it('should not instantiate a directive with cyclic dependencies', () => {
TestBed.configureTestingModule({declarations: [CycleDirective]});
expect(() => createComponent('
'))
.toThrowError(
/Template parse errors:\nCannot instantiate cyclic dependency! CycleDirective \("\[ERROR ->\]<\/div>"\): .*TestComp.html@0:0/);
});
- it('should not instantiate a directive in a view that has a host dependency on providers' +
- ' of the component',
- () => {
- TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsServiceFromHost]});
- TestBed.overrideComponent(
- SimpleComponent,
- {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
- TestBed.overrideComponent(
- SimpleComponent, {set: {template: '
'}});
+ fixmeIvy('unknown').it(
+ 'should not instantiate a directive in a view that has a host dependency on providers' +
+ ' of the component',
+ () => {
+ TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsServiceFromHost]});
+ TestBed.overrideComponent(
+ SimpleComponent,
+ {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
+ TestBed.overrideComponent(
+ SimpleComponent, {set: {template: '
'}});
- expect(() => createComponent('
'))
- .toThrowError(
- /Template parse errors:\nNo provider for service \("\[ERROR ->\]
"\): .*SimpleComponent.html@0:0/);
- });
+ expect(() => createComponent('
'))
+ .toThrowError(
+ /Template parse errors:\nNo provider for service \("\[ERROR ->\]
"\): .*SimpleComponent.html@0:0/);
+ });
- it('should not instantiate a directive in a view that has a host dependency on providers' +
- ' of a decorator directive',
- () => {
- TestBed.configureTestingModule(
- {declarations: [SimpleComponent, SomeOtherDirective, NeedsServiceFromHost]});
- TestBed.overrideComponent(
- SimpleComponent,
- {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
- TestBed.overrideComponent(
- SimpleComponent, {set: {template: '
'}});
+ fixmeIvy('unknown').it(
+ 'should not instantiate a directive in a view that has a host dependency on providers' +
+ ' of a decorator directive',
+ () => {
+ TestBed.configureTestingModule(
+ {declarations: [SimpleComponent, SomeOtherDirective, NeedsServiceFromHost]});
+ TestBed.overrideComponent(
+ SimpleComponent,
+ {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
+ TestBed.overrideComponent(
+ SimpleComponent, {set: {template: '
'}});
- expect(() => createComponent('
'))
- .toThrowError(
- /Template parse errors:\nNo provider for service \("\[ERROR ->\]
"\): .*SimpleComponent.html@0:0/);
- });
+ expect(() => createComponent('
'))
+ .toThrowError(
+ /Template parse errors:\nNo provider for service \("\[ERROR ->\]
"\): .*SimpleComponent.html@0:0/);
+ });
- it('should not instantiate a directive in a view that has a self dependency on a parent directive',
- () => {
- TestBed.configureTestingModule(
- {declarations: [SimpleDirective, NeedsDirectiveFromSelf]});
- expect(
- () =>
- createComponent('
'))
- .toThrowError(
- /Template parse errors:\nNo provider for SimpleDirective \("
\[ERROR ->\]
<\/div><\/div>"\): .*TestComp.html@0:21/);
- });
+ fixmeIvy('unknown').it(
+ 'should not instantiate a directive in a view that has a self dependency on a parent directive',
+ () => {
+ TestBed.configureTestingModule(
+ {declarations: [SimpleDirective, NeedsDirectiveFromSelf]});
+ expect(
+ () => createComponent(
+ '
'))
+ .toThrowError(
+ /Template parse errors:\nNo provider for SimpleDirective \("
\[ERROR ->\]
<\/div><\/div>"\): .*TestComp.html@0:21/);
+ });
it('should instantiate directives that depend on other directives', fakeAsync(() => {
TestBed.configureTestingModule({declarations: [SimpleDirective, NeedsDirective]});
@@ -662,48 +673,54 @@ class TestComp {
expect(d.dependency).toBeNull();
});
- it('should instantiate directives that depends on the host component', () => {
- TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsComponentFromHost]});
- TestBed.overrideComponent(
- SimpleComponent, {set: {template: '
'}});
- const el = createComponent('
');
- const d = el.children[0].children[0].injector.get(NeedsComponentFromHost);
- expect(d.dependency).toBeAnInstanceOf(SimpleComponent);
- });
+ fixmeIvy('unknown').it(
+ 'should instantiate directives that depends on the host component', () => {
+ TestBed.configureTestingModule(
+ {declarations: [SimpleComponent, NeedsComponentFromHost]});
+ TestBed.overrideComponent(
+ SimpleComponent, {set: {template: '
'}});
+ const el = createComponent('
');
+ const d = el.children[0].children[0].injector.get(NeedsComponentFromHost);
+ expect(d.dependency).toBeAnInstanceOf(SimpleComponent);
+ });
- it('should instantiate host views for components that have a @Host dependency ', () => {
- TestBed.configureTestingModule({declarations: [NeedsHostAppService]});
- const el = createComponent('', [], NeedsHostAppService);
- expect(el.componentInstance.service).toEqual('appService');
- });
+ fixmeIvy('unknown').it(
+ 'should instantiate host views for components that have a @Host dependency ', () => {
+ TestBed.configureTestingModule({declarations: [NeedsHostAppService]});
+ const el = createComponent('', [], NeedsHostAppService);
+ expect(el.componentInstance.service).toEqual('appService');
+ });
- it('should not instantiate directives that depend on other directives on the host element', () => {
- TestBed.configureTestingModule(
- {declarations: [SimpleComponent, SimpleDirective, NeedsDirectiveFromHost]});
- TestBed.overrideComponent(
- SimpleComponent, {set: {template: '
'}});
- expect(() => createComponent('
'))
- .toThrowError(
- /Template parse errors:\nNo provider for SimpleDirective \("\[ERROR ->\]
<\/div>"\): .*SimpleComponent.html@0:0/);
- });
+ fixmeIvy('unknown').it(
+ 'should not instantiate directives that depend on other directives on the host element',
+ () => {
+ TestBed.configureTestingModule(
+ {declarations: [SimpleComponent, SimpleDirective, NeedsDirectiveFromHost]});
+ TestBed.overrideComponent(
+ SimpleComponent, {set: {template: '
'}});
+ expect(() => createComponent('
'))
+ .toThrowError(
+ /Template parse errors:\nNo provider for SimpleDirective \("\[ERROR ->\]
<\/div>"\): .*SimpleComponent.html@0:0/);
+ });
- it('should allow to use the NgModule injector from a root ViewContainerRef.parentInjector',
- () => {
- @Component({template: ''})
- class MyComp {
- constructor(public vc: ViewContainerRef) {}
- }
+ fixmeIvy('unknown').it(
+ 'should allow to use the NgModule injector from a root ViewContainerRef.parentInjector',
+ () => {
+ @Component({template: ''})
+ class MyComp {
+ constructor(public vc: ViewContainerRef) {}
+ }
- const compFixture = TestBed
- .configureTestingModule({
- declarations: [MyComp],
- providers: [{provide: 'someToken', useValue: 'someValue'}]
- })
- .createComponent(MyComp);
+ const compFixture = TestBed
+ .configureTestingModule({
+ declarations: [MyComp],
+ providers: [{provide: 'someToken', useValue: 'someValue'}]
+ })
+ .createComponent(MyComp);
- expect(compFixture.componentInstance.vc.parentInjector.get('someToken'))
- .toBe('someValue');
- });
+ expect(compFixture.componentInstance.vc.parentInjector.get('someToken'))
+ .toBe('someValue');
+ });
});
describe('static attributes', () => {
@@ -734,85 +751,97 @@ class TestComp {
.toBe(el.children[0].nativeElement);
});
- it('should inject ChangeDetectorRef of the component\'s view into the component', () => {
- TestBed.configureTestingModule({declarations: [PushComponentNeedsChangeDetectorRef]});
- const cf = createComponentFixture('
');
- cf.detectChanges();
- const compEl = cf.debugElement.children[0];
- const comp = compEl.injector.get(PushComponentNeedsChangeDetectorRef);
- comp.counter = 1;
- cf.detectChanges();
- expect(compEl.nativeElement).toHaveText('0');
- comp.changeDetectorRef.markForCheck();
- cf.detectChanges();
- expect(compEl.nativeElement).toHaveText('1');
- });
+ fixmeIvy('unknown').it(
+ 'should inject ChangeDetectorRef of the component\'s view into the component', () => {
+ TestBed.configureTestingModule({declarations: [PushComponentNeedsChangeDetectorRef]});
+ const cf = createComponentFixture('
');
+ cf.detectChanges();
+ const compEl = cf.debugElement.children[0];
+ const comp = compEl.injector.get(PushComponentNeedsChangeDetectorRef);
+ comp.counter = 1;
+ cf.detectChanges();
+ expect(compEl.nativeElement).toHaveText('0');
+ comp.changeDetectorRef.markForCheck();
+ cf.detectChanges();
+ expect(compEl.nativeElement).toHaveText('1');
+ });
- it('should inject ChangeDetectorRef of the containing component into directives', () => {
- TestBed.configureTestingModule(
- {declarations: [PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]});
- TestBed.overrideComponent(PushComponentNeedsChangeDetectorRef, {
- set: {
- template:
- '{{counter}}
'
- }
- });
- const cf = createComponentFixture('
');
- cf.detectChanges();
- const compEl = cf.debugElement.children[0];
- const comp: PushComponentNeedsChangeDetectorRef =
- compEl.injector.get(PushComponentNeedsChangeDetectorRef);
- comp.counter = 1;
- cf.detectChanges();
- expect(compEl.nativeElement).toHaveText('0');
- expect(compEl.children[0].injector.get(DirectiveNeedsChangeDetectorRef).changeDetectorRef)
- .toEqual(comp.changeDetectorRef);
- expect(compEl.children[1].injector.get(DirectiveNeedsChangeDetectorRef).changeDetectorRef)
- .toEqual(comp.changeDetectorRef);
- comp.changeDetectorRef.markForCheck();
- cf.detectChanges();
- expect(compEl.nativeElement).toHaveText('1');
- });
+ fixmeIvy('unknown').it(
+ 'should inject ChangeDetectorRef of the containing component into directives', () => {
+ TestBed.configureTestingModule({
+ declarations:
+ [PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]
+ });
+ TestBed.overrideComponent(PushComponentNeedsChangeDetectorRef, {
+ set: {
+ template:
+ '{{counter}}
'
+ }
+ });
+ const cf = createComponentFixture('
');
+ cf.detectChanges();
+ const compEl = cf.debugElement.children[0];
+ const comp: PushComponentNeedsChangeDetectorRef =
+ compEl.injector.get(PushComponentNeedsChangeDetectorRef);
+ comp.counter = 1;
+ cf.detectChanges();
+ expect(compEl.nativeElement).toHaveText('0');
+ expect(
+ compEl.children[0].injector.get(DirectiveNeedsChangeDetectorRef).changeDetectorRef)
+ .toEqual(comp.changeDetectorRef);
+ expect(
+ compEl.children[1].injector.get(DirectiveNeedsChangeDetectorRef).changeDetectorRef)
+ .toEqual(comp.changeDetectorRef);
+ comp.changeDetectorRef.markForCheck();
+ cf.detectChanges();
+ expect(compEl.nativeElement).toHaveText('1');
+ });
- it('should inject ChangeDetectorRef of a same element component into a directive', () => {
- TestBed.configureTestingModule(
- {declarations: [PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]});
- const cf = createComponentFixture(
- '
');
- cf.detectChanges();
- const compEl = cf.debugElement.children[0];
- const comp = compEl.injector.get(PushComponentNeedsChangeDetectorRef);
- const dir = compEl.injector.get(DirectiveNeedsChangeDetectorRef);
- comp.counter = 1;
- cf.detectChanges();
- expect(compEl.nativeElement).toHaveText('0');
- dir.changeDetectorRef.markForCheck();
- cf.detectChanges();
- expect(compEl.nativeElement).toHaveText('1');
- });
+ fixmeIvy('unknown').it(
+ 'should inject ChangeDetectorRef of a same element component into a directive', () => {
+ TestBed.configureTestingModule({
+ declarations:
+ [PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]
+ });
+ const cf = createComponentFixture(
+ '
');
+ cf.detectChanges();
+ const compEl = cf.debugElement.children[0];
+ const comp = compEl.injector.get(PushComponentNeedsChangeDetectorRef);
+ const dir = compEl.injector.get(DirectiveNeedsChangeDetectorRef);
+ comp.counter = 1;
+ cf.detectChanges();
+ expect(compEl.nativeElement).toHaveText('0');
+ dir.changeDetectorRef.markForCheck();
+ cf.detectChanges();
+ expect(compEl.nativeElement).toHaveText('1');
+ });
- it(`should not inject ChangeDetectorRef of a parent element's component into a directive`, () => {
- TestBed
- .configureTestingModule({
- declarations: [PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]
- })
- .overrideComponent(
- PushComponentNeedsChangeDetectorRef,
- {set: {template: '
{{counter}}'}});
- const cf = createComponentFixture(
- '
');
- cf.detectChanges();
- const compEl = cf.debugElement.children[0];
- const comp = compEl.injector.get(PushComponentNeedsChangeDetectorRef);
- const dirEl = compEl.children[0];
- const dir = dirEl.injector.get(DirectiveNeedsChangeDetectorRef);
- comp.counter = 1;
- cf.detectChanges();
- expect(compEl.nativeElement).toHaveText('0');
- dir.changeDetectorRef.markForCheck();
- cf.detectChanges();
- expect(compEl.nativeElement).toHaveText('0');
- });
+ fixmeIvy('unknown').it(
+ `should not inject ChangeDetectorRef of a parent element's component into a directive`,
+ () => {
+ TestBed
+ .configureTestingModule({
+ declarations:
+ [PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]
+ })
+ .overrideComponent(
+ PushComponentNeedsChangeDetectorRef,
+ {set: {template: '
{{counter}}'}});
+ const cf = createComponentFixture(
+ '
');
+ cf.detectChanges();
+ const compEl = cf.debugElement.children[0];
+ const comp = compEl.injector.get(PushComponentNeedsChangeDetectorRef);
+ const dirEl = compEl.children[0];
+ const dir = dirEl.injector.get(DirectiveNeedsChangeDetectorRef);
+ comp.counter = 1;
+ cf.detectChanges();
+ expect(compEl.nativeElement).toHaveText('0');
+ dir.changeDetectorRef.markForCheck();
+ cf.detectChanges();
+ expect(compEl.nativeElement).toHaveText('0');
+ });
it('should inject ViewContainerRef', () => {
TestBed.configureTestingModule({declarations: [NeedsViewContainerRef]});
@@ -822,7 +851,7 @@ class TestComp {
.toBe(el.children[0].nativeElement);
});
- it('should inject ViewContainerRef', () => {
+ fixmeIvy('unknown').it('should inject ViewContainerRef', () => {
@Component({template: ''})
class TestComp {
constructor(public vcr: ViewContainerRef) {}
@@ -847,7 +876,7 @@ class TestComp {
expect(component.instance.vcr.parentInjector.get('someToken')).toBe('someNewValue');
});
- it('should inject TemplateRef', () => {
+ fixmeIvy('unknown').it('should inject TemplateRef', () => {
TestBed.configureTestingModule({declarations: [NeedsViewContainerRef, NeedsTemplateRef]});
const el =
createComponent('
');
@@ -855,7 +884,7 @@ class TestComp {
.toEqual(el.childNodes[0].injector.get(NeedsViewContainerRef).viewContainer.element);
});
- it('should throw if there is no TemplateRef', () => {
+ fixmeIvy('unknown').it('should throw if there is no TemplateRef', () => {
TestBed.configureTestingModule({declarations: [NeedsTemplateRef]});
expect(() => createComponent('
'))
.toThrowError(/No provider for TemplateRef!/);
@@ -870,7 +899,7 @@ class TestComp {
});
describe('pipes', () => {
- it('should instantiate pipes that have dependencies', () => {
+ fixmeIvy('unknown').it('should instantiate pipes that have dependencies', () => {
TestBed.configureTestingModule({declarations: [SimpleDirective, PipeNeedsService]});
const el = createComponent(
@@ -879,7 +908,7 @@ class TestComp {
expect(el.children[0].injector.get(SimpleDirective).value.service).toEqual('pipeService');
});
- it('should overwrite pipes with later entry in the pipes array', () => {
+ fixmeIvy('unknown').it('should overwrite pipes with later entry in the pipes array', () => {
TestBed.configureTestingModule(
{declarations: [SimpleDirective, DuplicatePipe1, DuplicatePipe2]});
const el = createComponent('
');
@@ -898,7 +927,7 @@ class TestComp {
expect(el.children[0].injector.get(SimpleDirective).value.changeDetectorRef).toEqual(cdRef);
});
- it('should cache pure pipes', () => {
+ fixmeIvy('unknown').it('should cache pure pipes', () => {
TestBed.configureTestingModule({declarations: [SimpleDirective, PurePipe]});
const el = createComponent(
'
' +
diff --git a/packages/core/test/view/component_view_spec.ts b/packages/core/test/view/component_view_spec.ts
index 2c5aa1a0e1..c8d97015e0 100644
--- a/packages/core/test/view/component_view_spec.ts
+++ b/packages/core/test/view/component_view_spec.ts
@@ -9,6 +9,7 @@
import {SecurityContext} from '@angular/core';
import {ArgumentType, BindingFlags, NodeCheckFn, NodeFlags, Services, ViewData, ViewFlags, ViewState, asElementData, directiveDef, elementDef, rootRenderNodes} from '@angular/core/src/view/index';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
+import {fixmeIvy} from '@angular/private/testing';
import {callMostRecentEventListenerHandler, compViewDef, createAndGetRootNodes, createRootView, isBrowser, recordNodeToRemove} from './helper';
@@ -199,62 +200,64 @@ const addEventListener = '__zone_symbol__addEventListener' as 'addEventListener'
});
if (isBrowser()) {
- it('should support OnPush components', () => {
- let compInputValue: any;
- class AComp {
- a: any;
- }
+ fixmeIvy('FW-665: Discovery util fails with "Unable to find context associated with ..."')
+ .it('should support OnPush components', () => {
+ let compInputValue: any;
+ class AComp {
+ a: any;
+ }
- const update = jasmine.createSpy('updater');
+ const update = jasmine.createSpy('updater');
- const addListenerSpy = spyOn(HTMLElement.prototype, addEventListener).and.callThrough();
+ const addListenerSpy =
+ spyOn(HTMLElement.prototype, addEventListener).and.callThrough();
- const {view} = createAndGetRootNodes(compViewDef(
- [
- elementDef(
- 0, NodeFlags.None, null, null, 1, 'div', null, null, null, null,
- () => {
- return compViewDef(
- [
- elementDef(
- 0, NodeFlags.None, null, null, 0, 'span', null, null,
- [[null !, 'click']]),
- ],
- update, null, ViewFlags.OnPush);
- }),
- directiveDef(1, NodeFlags.Component, null, 0, AComp, [], {a: [0, 'a']}),
- ],
- (check, view) => { check(view, 1, ArgumentType.Inline, compInputValue); }));
+ const {view} = createAndGetRootNodes(compViewDef(
+ [
+ elementDef(
+ 0, NodeFlags.None, null, null, 1, 'div', null, null, null, null,
+ () => {
+ return compViewDef(
+ [
+ elementDef(
+ 0, NodeFlags.None, null, null, 0, 'span', null, null,
+ [[null !, 'click']]),
+ ],
+ update, null, ViewFlags.OnPush);
+ }),
+ directiveDef(1, NodeFlags.Component, null, 0, AComp, [], {a: [0, 'a']}),
+ ],
+ (check, view) => { check(view, 1, ArgumentType.Inline, compInputValue); }));
- Services.checkAndUpdateView(view);
+ Services.checkAndUpdateView(view);
- // auto detach
- update.calls.reset();
- Services.checkAndUpdateView(view);
- expect(update).not.toHaveBeenCalled();
+ // auto detach
+ update.calls.reset();
+ Services.checkAndUpdateView(view);
+ expect(update).not.toHaveBeenCalled();
- // auto attach on input changes
- update.calls.reset();
- compInputValue = 'v1';
- Services.checkAndUpdateView(view);
- expect(update).toHaveBeenCalled();
+ // auto attach on input changes
+ update.calls.reset();
+ compInputValue = 'v1';
+ Services.checkAndUpdateView(view);
+ expect(update).toHaveBeenCalled();
- // auto detach
- update.calls.reset();
- Services.checkAndUpdateView(view);
- expect(update).not.toHaveBeenCalled();
+ // auto detach
+ update.calls.reset();
+ Services.checkAndUpdateView(view);
+ expect(update).not.toHaveBeenCalled();
- // auto attach on events
- callMostRecentEventListenerHandler(addListenerSpy, 'SomeEvent');
- update.calls.reset();
- Services.checkAndUpdateView(view);
- expect(update).toHaveBeenCalled();
+ // auto attach on events
+ callMostRecentEventListenerHandler(addListenerSpy, 'SomeEvent');
+ update.calls.reset();
+ Services.checkAndUpdateView(view);
+ expect(update).toHaveBeenCalled();
- // auto detach
- update.calls.reset();
- Services.checkAndUpdateView(view);
- expect(update).not.toHaveBeenCalled();
- });
+ // auto detach
+ update.calls.reset();
+ Services.checkAndUpdateView(view);
+ expect(update).not.toHaveBeenCalled();
+ });
}
it('should not stop dirty checking views that threw errors in change detection', () => {
diff --git a/packages/core/test/view/element_spec.ts b/packages/core/test/view/element_spec.ts
index 5e9fe24afd..868675c97e 100644
--- a/packages/core/test/view/element_spec.ts
+++ b/packages/core/test/view/element_spec.ts
@@ -11,6 +11,7 @@ import {getDebugContext} from '@angular/core/src/errors';
import {BindingFlags, NodeFlags, Services, ViewData, ViewDefinition, asElementData, elementDef} from '@angular/core/src/view/index';
import {TestBed} from '@angular/core/testing';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
+import {fixmeIvy} from '@angular/private/testing';
import {ARG_TYPE_VALUES, callMostRecentEventListenerHandler, checkNodeInlineOrDynamic, compViewDef, createAndGetRootNodes, isBrowser, recordNodeToRemove} from './helper';
@@ -184,26 +185,27 @@ const removeEventListener = '__zone_symbol__removeEventListener' as 'removeEvent
return result;
}
- it('should listen to DOM events', () => {
- const handleEventSpy = jasmine.createSpy('handleEvent');
- const removeListenerSpy =
- spyOn(HTMLElement.prototype, removeEventListener).and.callThrough();
- const {view, rootNodes} = createAndAttachAndGetRootNodes(compViewDef([elementDef(
- 0, NodeFlags.None, null, null, 0, 'button', null, null, [[null !, 'click']],
- handleEventSpy)]));
+ fixmeIvy('FW-665: Discovery util fails with "Unable to find context associated with ..."')
+ .it('should listen to DOM events', () => {
+ const handleEventSpy = jasmine.createSpy('handleEvent');
+ const removeListenerSpy =
+ spyOn(HTMLElement.prototype, removeEventListener).and.callThrough();
+ const {view, rootNodes} = createAndAttachAndGetRootNodes(compViewDef([elementDef(
+ 0, NodeFlags.None, null, null, 0, 'button', null, null, [[null !, 'click']],
+ handleEventSpy)]));
- rootNodes[0].click();
+ rootNodes[0].click();
- expect(handleEventSpy).toHaveBeenCalled();
- let handleEventArgs = handleEventSpy.calls.mostRecent().args;
- expect(handleEventArgs[0]).toBe(view);
- expect(handleEventArgs[1]).toBe('click');
- expect(handleEventArgs[2]).toBeTruthy();
+ expect(handleEventSpy).toHaveBeenCalled();
+ let handleEventArgs = handleEventSpy.calls.mostRecent().args;
+ expect(handleEventArgs[0]).toBe(view);
+ expect(handleEventArgs[1]).toBe('click');
+ expect(handleEventArgs[2]).toBeTruthy();
- Services.destroyView(view);
+ Services.destroyView(view);
- expect(removeListenerSpy).toHaveBeenCalled();
- });
+ expect(removeListenerSpy).toHaveBeenCalled();
+ });
it('should listen to window events', () => {
const handleEventSpy = jasmine.createSpy('handleEvent');
@@ -251,49 +253,52 @@ const removeEventListener = '__zone_symbol__removeEventListener' as 'removeEvent
expect(removeListenerSpy).toHaveBeenCalled();
});
- it('should preventDefault only if the handler returns false', () => {
- let eventHandlerResult: any;
- let preventDefaultSpy: jasmine.Spy = undefined !;
+ fixmeIvy('FW-665: Discovery util fails with "Unable to find context associated with ..."')
+ .it('should preventDefault only if the handler returns false', () => {
+ let eventHandlerResult: any;
+ let preventDefaultSpy: jasmine.Spy = undefined !;
- const {view, rootNodes} = createAndAttachAndGetRootNodes(compViewDef([elementDef(
- 0, NodeFlags.None, null, null, 0, 'button', null, null, [[null !, 'click']],
- (view, eventName, event) => {
- preventDefaultSpy = spyOn(event, 'preventDefault').and.callThrough();
- return eventHandlerResult;
- })]));
+ const {view, rootNodes} = createAndAttachAndGetRootNodes(compViewDef([elementDef(
+ 0, NodeFlags.None, null, null, 0, 'button', null, null, [[null !, 'click']],
+ (view, eventName, event) => {
+ preventDefaultSpy = spyOn(event, 'preventDefault').and.callThrough();
+ return eventHandlerResult;
+ })]));
- eventHandlerResult = undefined;
- rootNodes[0].click();
- expect(preventDefaultSpy).not.toHaveBeenCalled();
+ eventHandlerResult = undefined;
+ rootNodes[0].click();
+ expect(preventDefaultSpy).not.toHaveBeenCalled();
- eventHandlerResult = true;
- rootNodes[0].click();
- expect(preventDefaultSpy).not.toHaveBeenCalled();
+ eventHandlerResult = true;
+ rootNodes[0].click();
+ expect(preventDefaultSpy).not.toHaveBeenCalled();
- eventHandlerResult = 'someString';
- rootNodes[0].click();
- expect(preventDefaultSpy).not.toHaveBeenCalled();
+ eventHandlerResult = 'someString';
+ rootNodes[0].click();
+ expect(preventDefaultSpy).not.toHaveBeenCalled();
- eventHandlerResult = false;
- rootNodes[0].click();
- expect(preventDefaultSpy).toHaveBeenCalled();
- });
+ eventHandlerResult = false;
+ rootNodes[0].click();
+ expect(preventDefaultSpy).toHaveBeenCalled();
+ });
- it('should report debug info on event errors', () => {
- const handleErrorSpy = spyOn(TestBed.get(ErrorHandler), 'handleError');
- const addListenerSpy = spyOn(HTMLElement.prototype, addEventListener).and.callThrough();
- const {view, rootNodes} = createAndAttachAndGetRootNodes(compViewDef([elementDef(
- 0, NodeFlags.None, null, null, 0, 'button', null, null, [[null !, 'click']],
- () => { throw new Error('Test'); })]));
+ fixmeIvy('FW-665: Discovery util fails with "Unable to find context associated with ..."')
+ .it('should report debug info on event errors', () => {
+ const handleErrorSpy = spyOn(TestBed.get(ErrorHandler), 'handleError');
+ const addListenerSpy =
+ spyOn(HTMLElement.prototype, addEventListener).and.callThrough();
+ const {view, rootNodes} = createAndAttachAndGetRootNodes(compViewDef([elementDef(
+ 0, NodeFlags.None, null, null, 0, 'button', null, null, [[null !, 'click']],
+ () => { throw new Error('Test'); })]));
- callMostRecentEventListenerHandler(addListenerSpy, 'SomeEvent');
- const err = handleErrorSpy.calls.mostRecent().args[0];
- expect(err).toBeTruthy();
- expect(err.message).toBe('Test');
- const debugCtx = getDebugContext(err);
- expect(debugCtx.view).toBe(view);
- expect(debugCtx.nodeIndex).toBe(0);
- });
+ callMostRecentEventListenerHandler(addListenerSpy, 'SomeEvent');
+ const err = handleErrorSpy.calls.mostRecent().args[0];
+ expect(err).toBeTruthy();
+ expect(err.message).toBe('Test');
+ const debugCtx = getDebugContext(err);
+ expect(debugCtx.view).toBe(view);
+ expect(debugCtx.nodeIndex).toBe(0);
+ });
});
}
});