test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags (#26471)
We are close enough to blacklist a few test targets, rather than whitelist targets to run... Because bazel rules can be composed of other rules that don't inherit tags automatically, I had to explicitly mark all of our ts_library and ng_module targes with "ivy-local" and "ivy-jit" tags so that we can create a query that excludes all fixme- tagged targets even if those targets are composed of other targets that don't inherit this tag. This is the updated overview of ivy related bazel tags: - ivy-only: target that builds or runs only under ivy - fixme-ivy-jit: target that doesn't yet build or run under ivy with --compile=jit - fixme-ivy-local: target that doesn't yet build or run under ivy with --compile=local - no-ivy-jit: target that is not intended to build or run under ivy with --compile=jit - no-ivy-local: target that is not intended to build or run under ivy with --compile=local PR Close #26471
This commit is contained in:

committed by
Alex Rickabaugh

parent
361eaf1888
commit
4237c34c78
@ -0,0 +1,109 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {AnimationBuilder, animate, style} from '@angular/animations';
|
||||
import {AnimationDriver} from '@angular/animations/browser';
|
||||
import {MockAnimationDriver} from '@angular/animations/browser/testing';
|
||||
import {Component, ViewChild} from '@angular/core';
|
||||
import {TestBed, fakeAsync, flushMicrotasks} from '@angular/core/testing';
|
||||
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
|
||||
|
||||
import {el} from '../../testing/src/browser_util';
|
||||
import {BrowserAnimationBuilder} from '../src/animation_builder';
|
||||
|
||||
{
|
||||
describe('BrowserAnimationBuilder', () => {
|
||||
if (isNode) return;
|
||||
let element: any;
|
||||
beforeEach(() => {
|
||||
element = el('<div></div>');
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopAnimationsModule],
|
||||
providers: [{provide: AnimationDriver, useClass: MockAnimationDriver}]
|
||||
});
|
||||
});
|
||||
|
||||
it('should inject AnimationBuilder into a component', () => {
|
||||
@Component({
|
||||
selector: 'ani-cmp',
|
||||
template: '...',
|
||||
})
|
||||
class Cmp {
|
||||
constructor(public builder: AnimationBuilder) {}
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(cmp.builder instanceof BrowserAnimationBuilder).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should listen on start and done on the animation builder\'s player', fakeAsync(() => {
|
||||
@Component({
|
||||
selector: 'ani-cmp',
|
||||
template: '...',
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('target') public target: any;
|
||||
|
||||
constructor(public builder: AnimationBuilder) {}
|
||||
|
||||
build() {
|
||||
const definition =
|
||||
this.builder.build([style({opacity: 0}), animate(1000, style({opacity: 1}))]);
|
||||
|
||||
return definition.create(this.target);
|
||||
}
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
||||
const player = cmp.build();
|
||||
|
||||
let started = false;
|
||||
player.onStart(() => started = true);
|
||||
|
||||
let finished = false;
|
||||
player.onDone(() => finished = true);
|
||||
|
||||
let destroyed = false;
|
||||
player.onDestroy(() => destroyed = true);
|
||||
|
||||
player.init();
|
||||
flushMicrotasks();
|
||||
expect(started).toBeFalsy();
|
||||
expect(finished).toBeFalsy();
|
||||
expect(destroyed).toBeFalsy();
|
||||
|
||||
player.play();
|
||||
flushMicrotasks();
|
||||
expect(started).toBeTruthy();
|
||||
expect(finished).toBeFalsy();
|
||||
expect(destroyed).toBeFalsy();
|
||||
|
||||
player.finish();
|
||||
flushMicrotasks();
|
||||
expect(started).toBeTruthy();
|
||||
expect(finished).toBeTruthy();
|
||||
expect(destroyed).toBeFalsy();
|
||||
|
||||
player.destroy();
|
||||
flushMicrotasks();
|
||||
expect(started).toBeTruthy();
|
||||
expect(finished).toBeTruthy();
|
||||
expect(destroyed).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user