test(ivy): run common tests with ivy on ci (#27071)

PR Close #27071
This commit is contained in:
Pawel Kozlowski 2018-11-13 11:51:02 +01:00 committed by Andrew Kushnir
parent 9741f5b8cf
commit 7695dbd0bd
7 changed files with 378 additions and 391 deletions

View File

@ -15,15 +15,13 @@ ts_library(
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"//packages/platform-browser/testing",
"//packages/private/testing",
],
)
jasmine_node_test(
name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
tags = [
"fixme-ivy-aot",
],
deps = [
":test_lib",
"//tools/testing:node",
@ -32,9 +30,6 @@ jasmine_node_test(
ts_web_test_suite(
name = "test_web",
tags = [
"fixme-ivy-aot",
],
deps = [
":test_lib",
],

View File

@ -7,12 +7,10 @@
*/
import {DeprecatedI18NPipesModule, Plural} from '@angular/common';
import {DEPRECATED_PLURAL_FN, getPluralCase} from '@angular/common/src/i18n/localization';
import {TestBed, inject} from '@angular/core/testing';
import {DeprecatedI18NPipesModule} from '../src/common_module';
import {Plural} from '../src/i18n/locale_data_api';
import {DEPRECATED_PLURAL_FN, getPluralCase} from '../src/i18n/localization';
{
describe('DeprecatedI18NPipesModule', () => {
beforeEach(() => { TestBed.configureTestingModule({imports: [DeprecatedI18NPipesModule]}); });
@ -23,4 +21,3 @@ import {DEPRECATED_PLURAL_FN, getPluralCase} from '../src/i18n/localization';
expect(injectedGetPluralCase).toEqual(getPluralCase);
}));
});
}

View File

@ -8,11 +8,11 @@
import {CommonModule} from '@angular/common';
import {NgComponentOutlet} from '@angular/common/src/directives/ng_component_outlet';
import {Compiler, Component, ComponentRef, Inject, InjectionToken, Injector, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory, Optional, QueryList, StaticProvider, TemplateRef, Type, ViewChild, ViewChildren, ViewContainerRef} from '@angular/core';
import {TestBed, async, fakeAsync} from '@angular/core/testing';
import {Compiler, Component, ComponentRef, Inject, InjectionToken, Injector, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory, Optional, QueryList, TemplateRef, Type, ViewChild, ViewChildren, ViewContainerRef} from '@angular/core';
import {TestBed, async} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
{
describe('insert/remove', () => {
beforeEach(() => { TestBed.configureTestingModule({imports: [TestModule]}); });
@ -91,6 +91,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
expect(fixture.nativeElement).toHaveText('bar');
}));
fixmeIvy('ComponentFactoryResolver not resolved with supplied injector') &&
it('should use the injector, if one supplied', async(() => {
let fixture = TestBed.createComponent(TestComponent);
@ -119,6 +120,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
expect(cmpRef.instance.testToken).toBeNull();
}));
fixmeIvy('can not pass projectable nodes') &&
it('should render projectable nodes, if supplied', async(() => {
const template = `<ng-template>projected foo</ng-template>${TEST_CMP_TEMPLATE}`;
TestBed.overrideComponent(TestComponent, {set: {template: template}})
@ -144,6 +146,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
expect(fixture.nativeElement).toHaveText('projected foo');
}));
fixmeIvy('Runtime compiler is not loaded') &&
it('should resolve components from other modules, if supplied', async(() => {
const compiler = TestBed.get(Compiler) as Compiler;
let fixture = TestBed.createComponent(TestComponent);
@ -158,6 +161,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
expect(fixture.nativeElement).toHaveText('baz');
}));
fixmeIvy('Runtime compiler is not loaded') &&
it('should clean up moduleRef, if supplied', async(() => {
let destroyed = false;
const compiler = TestBed.get(Compiler) as Compiler;
@ -174,6 +178,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
expect(moduleRef.destroy).toHaveBeenCalled();
}));
fixmeIvy('Runtime compiler is not loaded') &&
it('should not re-create moduleRef when it didn\'t actually change', async(() => {
const compiler = TestBed.get(Compiler) as Compiler;
const fixture = TestBed.createComponent(TestComponent);
@ -191,6 +196,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
expect(moduleRef).toBe(fixture.componentInstance.ngComponentOutlet['_moduleRef']);
}));
fixmeIvy('Runtime compiler is not loaded') &&
it('should re-create moduleRef when changed', async(() => {
const compiler = TestBed.get(Compiler) as Compiler;
const fixture = TestBed.createComponent(TestComponent);
@ -207,7 +213,6 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
expect(fixture.nativeElement).toHaveText('bat');
}));
});
}
const TEST_TOKEN = new InjectionToken('TestToken');
@Component({selector: 'injected-component', template: 'foo'})

View File

@ -10,9 +10,9 @@ import {CommonModule} from '@angular/common';
import {Component, ContentChildren, Directive, Injectable, NO_ERRORS_SCHEMA, OnDestroy, QueryList, TemplateRef} from '@angular/core';
import {ComponentFixture, TestBed, async} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
{
describe('NgTemplateOutlet', () => {
fixmeIvy('expr.visitExpression is not a function - fixed by #26968') && describe('NgTemplateOutlet', () => {
let fixture: ComponentFixture<any>;
function setTplRef(value: any): void { fixture.componentInstance.currentTplRef = value; }
@ -112,8 +112,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
}));
it('should reflect context re-binding', async(() => {
const template =
`<ng-template let-shawshank="shawshank" #tpl>{{shawshank}}</ng-template>` +
const template = `<ng-template let-shawshank="shawshank" #tpl>{{shawshank}}</ng-template>` +
`<ng-container *ngTemplateOutlet="tpl; context: context"></ng-container>`;
fixture = createTestComponent(template);
@ -156,8 +155,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
expect(spyService.destroyed).toBeTruthy();
});
it('should destroy embedded view when context value changes and templateRef becomes undefined',
() => {
it('should destroy embedded view when context value changes and templateRef becomes undefined', () => {
const template =
`<ng-template let-foo="foo" #tpl><destroyable-cmpt></destroyable-cmpt>:{{foo}}</ng-template>` +
`<ng-template [ngTemplateOutlet]="value === 'bar' ? tpl : undefined" [ngTemplateOutletContext]="{foo: value}"></ng-template>`;
@ -208,7 +206,6 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
detectChangesAndExpectText('');
});
});
}
@Injectable()
class DestroyedSpyService {

View File

@ -12,8 +12,8 @@ import localeZgh from '@angular/common/locales/zgh';
import localeFr from '@angular/common/locales/fr';
import {LOCALE_ID} from '@angular/core';
import {TestBed, inject} from '@angular/core/testing';
import {NgLocaleLocalization, NgLocalization, getPluralCategory, DEPRECATED_PLURAL_FN, getPluralCase} from '../../src/i18n/localization';
import {Plural} from '../../src/i18n/locale_data_api';
import {NgLocaleLocalization, NgLocalization, getPluralCategory, DEPRECATED_PLURAL_FN, getPluralCase} from '@angular/common/src/i18n/localization';
import {Plural} from '@angular/common';
import {registerLocaleData} from '../../src/i18n/locale_data';
{

View File

@ -6,9 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/
import {Location} from '../../src/location/location';
import {Location} from '@angular/common';
{
const baseUrl = '/base';
describe('Location Class', () => {
@ -39,4 +38,3 @@ import {Location} from '../../src/location/location';
});
});
});
}

View File

@ -7,13 +7,8 @@
*/
import {KeyValuePipe} from '@angular/common';
import {EventEmitter, KeyValueDiffers, WrappedValue, ɵdefaultKeyValueDiffers as defaultKeyValueDiffers} from '@angular/core';
import {AsyncTestCompleter, beforeEach, describe, expect, inject, it} from '@angular/core/testing/src/testing_internal';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {browserDetection} from '@angular/platform-browser/testing/src/browser_util';
import {defaultComparator} from '../../src/pipes/keyvalue_pipe';
import {SpyChangeDetectorRef} from '../spies';
import {defaultComparator} from '@angular/common/src/pipes/keyvalue_pipe';
import {ɵdefaultKeyValueDiffers as defaultKeyValueDiffers} from '@angular/core';
describe('KeyValuePipe', () => {
it('should return null when given null', () => {