build: upgrade jasmine (and related typings) to latest version (#19904)
With these changes, the types are a little stricter now and also not
compatible with Protractor's jasmine-like syntax. So, we have to also
use `@types/jasminewd2` for e2e tests (but not for non-e2e tests).
I also had to "augment" `@types/jasminewd2`, because the latest
typings from [DefinitelyTyped][1] do not reflect the fact that the
`jasminewd2` version (v2.1.0) currently used by Protractor supports
passing a `done` callback to a spec.
[1]: 566e039485/types/jasminewd2/index.d.ts (L9-L15)
Fixes #23952
Closes #24733
PR Close #19904
This commit is contained in:
parent
1e74ea9e60
commit
00c110b055
4
build.sh
4
build.sh
|
@ -409,6 +409,10 @@ if [[ ${BUILD_ALL} == true && ${TYPECHECK_ALL} == true ]]; then
|
|||
travisFoldStart "tsc -p ${TSCONFIG}" "no-xtrace"
|
||||
$TSC -p ${TSCONFIG}
|
||||
travisFoldEnd "tsc -p ${TSCONFIG}"
|
||||
TSCONFIG="packages/examples/tsconfig.json"
|
||||
travisFoldStart "tsc -p ${TSCONFIG}" "no-xtrace"
|
||||
$TSC -p ${TSCONFIG}
|
||||
travisFoldEnd "tsc -p ${TSCONFIG}"
|
||||
TSCONFIG="modules/tsconfig.json"
|
||||
travisFoldStart "tsc -p ${TSCONFIG}" "no-xtrace"
|
||||
$TSC -p ${TSCONFIG}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "../dist/e2e",
|
||||
"types": ["jasmine"],
|
||||
"types": [
|
||||
"jasmine",
|
||||
"jasminewd2"
|
||||
],
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"concurrently": "3.4.0",
|
||||
"lite-server": "2.2.2",
|
||||
"protractor": "file:../../node_modules/protractor",
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
|
||||
// This file contains all ambient imports needed to compile the modules/ source code
|
||||
|
||||
/// <reference path="../node_modules/zone.js/dist/zone.js.d.ts" />
|
||||
/// <reference path="../node_modules/@types/hammerjs/index.d.ts" />
|
||||
/// <reference path="../node_modules/@types/jasmine/index.d.ts" />
|
||||
/// <reference path="../node_modules/@types/jasminewd2/index.d.ts" />
|
||||
/// <reference path="../node_modules/@types/node/index.d.ts" />
|
||||
/// <reference path="../node_modules/@types/selenium-webdriver/index.d.ts" />
|
||||
/// <reference path="../node_modules/zone.js/dist/zone.js.d.ts" />
|
||||
/// <reference path="../tools/types-ext/jasminewd2.d.ts" />
|
||||
/// <reference path="./es6-subset.d.ts" />
|
||||
/// <reference path="./system.d.ts" />
|
||||
|
|
|
@ -47,7 +47,8 @@
|
|||
"@types/diff": "^3.2.2",
|
||||
"@types/fs-extra": "4.0.2",
|
||||
"@types/hammerjs": "2.0.35",
|
||||
"@types/jasmine": "2.2.22-alpha",
|
||||
"@types/jasmine": "^2.8.8",
|
||||
"@types/jasminewd2": "^2.0.3",
|
||||
"@types/minimist": "^1.2.0",
|
||||
"@types/node": "6.0.88",
|
||||
"@types/selenium-webdriver": "3.0.7",
|
||||
|
@ -84,8 +85,8 @@
|
|||
"hammerjs": "2.0.8",
|
||||
"husky": "^0.14.3",
|
||||
"incremental-dom": "0.4.1",
|
||||
"jasmine": "2.4.1",
|
||||
"jasmine-core": "2.4.1",
|
||||
"jasmine": "2.8",
|
||||
"jasmine-core": "2.8",
|
||||
"jpm": "1.3.1",
|
||||
"karma": "0.13.20",
|
||||
"karma-browserstack-launcher": "0.1.9",
|
||||
|
|
|
@ -30,7 +30,7 @@ export interface TestSupport {
|
|||
writeFiles(...mockDirs: {[fileName: string]: string}[]): void;
|
||||
shouldExist(fileName: string): void;
|
||||
shouldNotExist(fileName: string): void;
|
||||
runOneBuild(): void;
|
||||
runOneBuild(): boolean;
|
||||
}
|
||||
|
||||
export function setup(
|
||||
|
|
|
@ -48,13 +48,11 @@ import {Options, PerfLogEvent, PerfLogFeatures, UserMetric, WebDriverAdapter} fr
|
|||
const metric = createMetric(
|
||||
[[]], new PerfLogFeatures(),
|
||||
{userMetrics: {'loadTime': 'time to load', 'content': 'time to see content'}});
|
||||
metric.beginMeasure()
|
||||
.then((_) => metric.endMeasure(true))
|
||||
.then((values: {[key: string]: string}) => {
|
||||
expect(values['loadTime']).toBe(25);
|
||||
expect(values['content']).toBe(250);
|
||||
async.done();
|
||||
});
|
||||
metric.beginMeasure().then(() => metric.endMeasure(true)).then(values => {
|
||||
expect(values['loadTime']).toBe(25);
|
||||
expect(values['content']).toBe(250);
|
||||
async.done();
|
||||
});
|
||||
|
||||
wdAdapter.data['loadTime'] = 25;
|
||||
// Wait before setting 2nd property.
|
||||
|
|
|
@ -166,12 +166,12 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
|
|||
fixture.componentInstance.currentComponent = Module2InjectedComponent;
|
||||
fixture.detectChanges();
|
||||
|
||||
const moduleRef = fixture.componentInstance.ngComponentOutlet['_moduleRef'];
|
||||
const moduleRef = fixture.componentInstance.ngComponentOutlet['_moduleRef'] !;
|
||||
spyOn(moduleRef, 'destroy').and.callThrough();
|
||||
|
||||
expect(moduleRef !.destroy).not.toHaveBeenCalled();
|
||||
expect(moduleRef.destroy).not.toHaveBeenCalled();
|
||||
fixture.destroy();
|
||||
expect(moduleRef !.destroy).toHaveBeenCalled();
|
||||
expect(moduleRef.destroy).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should not re-create moduleRef when it didn\'t actually change', async(() => {
|
||||
|
|
|
@ -16,10 +16,9 @@ export class FeatureComponent {
|
|||
@NgModule({
|
||||
declarations: [FeatureComponent],
|
||||
imports: [RouterModule.forChild([
|
||||
{path: '', component: FeatureComponent}, {path: 'd', loadChildren: './default.module'} {
|
||||
path: 'e',
|
||||
loadChildren: 'feature/feature.module#FeatureModule'
|
||||
}
|
||||
{path: '', component: FeatureComponent},
|
||||
{path: 'd', loadChildren: './default.module'},
|
||||
{path: 'e', loadChildren: 'feature/feature.module#FeatureModule'},
|
||||
])]
|
||||
})
|
||||
export class Feature2Module {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {CompilerHost, CompilerOptions, LazyRoute} from './transformers/api';
|
||||
import {CompilerOptions} from './transformers/api';
|
||||
import {getOriginalReferences} from './transformers/compiler_host';
|
||||
import {createProgram} from './transformers/entry_points';
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ describe('expression diagnostics', () => {
|
|||
}
|
||||
}
|
||||
|
||||
function reject(template: string, expected: string | RegExp) {
|
||||
function reject(template: string, expected: string) {
|
||||
const info = getDiagnosticTemplateInfo(context, type, 'app/app.component.html', template);
|
||||
if (info) {
|
||||
const diagnostics = getTemplateExpressionDiagnostics(info);
|
||||
|
@ -240,4 +240,4 @@ const FILES: Directory = {
|
|||
`
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import * as ts from 'typescript';
|
||||
|
||||
import {MetadataCollector} from '../../src/metadata/collector';
|
||||
import {ClassMetadata, ConstructorMetadata, METADATA_VERSION, MetadataEntry, ModuleMetadata, isClassMetadata, isMetadataGlobalReferenceExpression} from '../../src/metadata/schema';
|
||||
import {ClassMetadata, ConstructorMetadata, METADATA_VERSION, MetadataEntry, MetadataMap, MetadataSymbolicExpression, ModuleMetadata, isClassMetadata, isMetadataGlobalReferenceExpression} from '../../src/metadata/schema';
|
||||
|
||||
import {Directory, Host, expectValidSources} from './typescript.mocks';
|
||||
|
||||
|
@ -269,9 +269,11 @@ describe('Collector', () => {
|
|||
it('should provide any reference for an any ctor parameter type', () => {
|
||||
const casesAny = <ClassMetadata>casesMetadata.metadata['CaseAny'];
|
||||
expect(casesAny).toBeTruthy();
|
||||
const ctorData = casesAny.members !['__ctor__'];
|
||||
expect(ctorData).toEqual(
|
||||
[{__symbolic: 'constructor', parameters: [{__symbolic: 'reference', name: 'any'}]}]);
|
||||
const ctorData = casesAny.members !['__ctor__'] as ConstructorMetadata[];
|
||||
expect(ctorData).toEqual([{
|
||||
__symbolic: 'constructor',
|
||||
parameters: [{__symbolic: 'reference', name: 'any'} as MetadataSymbolicExpression]
|
||||
}]);
|
||||
});
|
||||
|
||||
it('should record annotations on set and get declarations', () => {
|
||||
|
@ -285,7 +287,8 @@ describe('Collector', () => {
|
|||
arguments: ['firstName']
|
||||
}]
|
||||
}]
|
||||
});
|
||||
} as any as MetadataMap); // TODO: Review use of `any` here (#19904)
|
||||
|
||||
const caseGetProp = <ClassMetadata>casesMetadata.metadata['GetProp'];
|
||||
expect(caseGetProp.members).toEqual(propertyData(11));
|
||||
const caseSetProp = <ClassMetadata>casesMetadata.metadata['SetProp'];
|
||||
|
@ -297,8 +300,7 @@ describe('Collector', () => {
|
|||
it('should record references to parameterized types', () => {
|
||||
const casesForIn = <ClassMetadata>casesMetadata.metadata['NgFor'];
|
||||
expect(casesForIn).toEqual({
|
||||
__symbolic: 'class',
|
||||
decorators: [{
|
||||
__symbolic: 'class', decorators: [{
|
||||
__symbolic: 'call',
|
||||
expression: {
|
||||
__symbolic: 'reference',
|
||||
|
@ -308,17 +310,17 @@ describe('Collector', () => {
|
|||
character: 7
|
||||
}
|
||||
}],
|
||||
members: {
|
||||
__ctor__: [{
|
||||
__symbolic: 'constructor',
|
||||
parameters: [{
|
||||
__symbolic: 'reference',
|
||||
name: 'ClassReference',
|
||||
arguments: [{__symbolic: 'reference', name: 'NgForRow'}]
|
||||
}]
|
||||
}]
|
||||
}
|
||||
});
|
||||
members: {
|
||||
__ctor__: [{
|
||||
__symbolic: 'constructor',
|
||||
parameters: [{
|
||||
__symbolic: 'reference',
|
||||
name: 'ClassReference',
|
||||
arguments: [{__symbolic: 'reference', name: 'NgForRow'}]
|
||||
}]
|
||||
}]
|
||||
}
|
||||
} as any as ClassMetadata); // TODO: Review use of `any` here (#19904)
|
||||
});
|
||||
|
||||
it('should report errors for destructured imports', () => {
|
||||
|
@ -358,9 +360,9 @@ describe('Collector', () => {
|
|||
const someClass = <ClassMetadata>metadata.metadata['SomeClass'];
|
||||
const ctor = <ConstructorMetadata>someClass.members !['__ctor__'][0];
|
||||
const parameters = ctor.parameters;
|
||||
expect(parameters).toEqual([
|
||||
{__symbolic: 'reference', module: 'angular2/common', name: 'NgFor', line: 6, character: 29}
|
||||
]);
|
||||
expect(parameters).toEqual([{
|
||||
__symbolic: 'reference', module: 'angular2/common', name: 'NgFor', line: 6, character: 29
|
||||
} as MetadataSymbolicExpression]);
|
||||
});
|
||||
|
||||
it('should record all exported classes', () => {
|
||||
|
@ -443,9 +445,9 @@ describe('Collector', () => {
|
|||
const someClass = <ClassMetadata>metadata.metadata['SomeClass'];
|
||||
const ctor = <ConstructorMetadata>someClass.members !['__ctor__'][0];
|
||||
const parameters = ctor.parameters;
|
||||
expect(parameters).toEqual([
|
||||
{__symbolic: 'reference', module: 'angular2/common', name: 'NgFor', line: 6, character: 29}
|
||||
]);
|
||||
expect(parameters).toEqual([{
|
||||
__symbolic: 'reference', module: 'angular2/common', name: 'NgFor', line: 6, character: 29
|
||||
} as MetadataSymbolicExpression]);
|
||||
});
|
||||
|
||||
it('should be able to collect the value of an enum', () => {
|
||||
|
@ -533,7 +535,7 @@ describe('Collector', () => {
|
|||
arguments: ['a']
|
||||
}
|
||||
}]
|
||||
}]);
|
||||
}] as any as MetadataSymbolicExpression[]); // TODO: Review use of `any` here (#19904)
|
||||
});
|
||||
|
||||
it('should be able to collect a static field', () => {
|
||||
|
@ -576,7 +578,7 @@ describe('Collector', () => {
|
|||
}
|
||||
}]
|
||||
}]
|
||||
}]);
|
||||
}] as any as MetadataSymbolicExpression[]); // TODO: Review use of `any` here (#19904)
|
||||
});
|
||||
|
||||
it('should be able to collect a method with a conditional expression', () => {
|
||||
|
@ -764,7 +766,7 @@ describe('Collector', () => {
|
|||
}]],
|
||||
parameters: [{__symbolic: 'reference', name: 'any'}]
|
||||
}]
|
||||
});
|
||||
} as any as MetadataMap); // TODO: Review use of `any` here (#19904)
|
||||
});
|
||||
|
||||
describe('with interpolations', () => {
|
||||
|
@ -868,7 +870,7 @@ describe('Collector', () => {
|
|||
{__symbolic: 'reference', module: './foo', name: 'Foo', line: 3, character: 24}
|
||||
]
|
||||
}]
|
||||
});
|
||||
} as any as MetadataMap); // TODO: Review use of `any` here (#19904)
|
||||
});
|
||||
|
||||
it('should treat exported class expressions as a class', () => {
|
||||
|
|
|
@ -1747,7 +1747,7 @@ describe('ngc transformer command-line', () => {
|
|||
const exitCode =
|
||||
main(['-p', path.join(basePath, 'src/tsconfig.json')], message => messages.push(message));
|
||||
expect(exitCode).toBe(1, 'Compile was expected to fail');
|
||||
expect(messages[0]).toContain(['Tagged template expressions are not supported in metadata']);
|
||||
expect(messages[0]).toContain('Tagged template expressions are not supported in metadata');
|
||||
});
|
||||
|
||||
// Regression: #20076
|
||||
|
|
|
@ -502,7 +502,7 @@ describe('TypeScriptNodeEmitter', () => {
|
|||
generatedColumn: 0,
|
||||
originalLine: 1,
|
||||
originalColumn: 0,
|
||||
name: null
|
||||
name: null ! // TODO: Review use of `!` here (#19904)
|
||||
},
|
||||
{
|
||||
source: sourceUrl,
|
||||
|
@ -510,7 +510,7 @@ describe('TypeScriptNodeEmitter', () => {
|
|||
generatedColumn: 16,
|
||||
originalLine: 1,
|
||||
originalColumn: 26,
|
||||
name: null
|
||||
name: null ! // TODO: Review use of `!` here (#19904)
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
|
|
@ -373,8 +373,8 @@ describe('ng program', () => {
|
|||
{rootNames: [path.resolve(testSupport.basePath, 'src/main.ts')], options, host});
|
||||
program.loadNgStructureAsync().then(() => {
|
||||
program.emit();
|
||||
const factory =
|
||||
fs.readFileSync(path.resolve(testSupport.basePath, 'built/src/main.ngfactory.js'));
|
||||
const ngFactoryPath = path.resolve(testSupport.basePath, 'built/src/main.ngfactory.js');
|
||||
const factory = fs.readFileSync(ngFactoryPath, 'utf8');
|
||||
expect(factory).toContain('Hello world!');
|
||||
done();
|
||||
});
|
||||
|
@ -677,8 +677,9 @@ describe('ng program', () => {
|
|||
program.listLazyRoutes();
|
||||
program.emit();
|
||||
|
||||
const lazyNgFactory =
|
||||
fs.readFileSync(path.resolve(testSupport.basePath, 'built/src/lazy/lazy.ngfactory.js'));
|
||||
const ngFactoryPath = path.resolve(testSupport.basePath, 'built/src/lazy/lazy.ngfactory.js');
|
||||
const lazyNgFactory = fs.readFileSync(ngFactoryPath, 'utf8');
|
||||
|
||||
expect(lazyNgFactory).toContain('import * as i1 from "./lazy";');
|
||||
});
|
||||
|
||||
|
@ -735,8 +736,10 @@ describe('ng program', () => {
|
|||
expect(normalizeRoutes(program.listLazyRoutes('src/main#MainModule'))).toEqual([
|
||||
{
|
||||
module: {name: 'MainModule', filePath: path.resolve(testSupport.basePath, 'src/main.ts')},
|
||||
referencedModule:
|
||||
{name: undefined, filePath: path.resolve(testSupport.basePath, 'src/child.ts')},
|
||||
referencedModule: {
|
||||
name: undefined as any as string, // TODO: Review use of `any` here (#19904)
|
||||
filePath: path.resolve(testSupport.basePath, 'src/child.ts')
|
||||
},
|
||||
route: './child'
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -103,83 +103,86 @@ import * as core from '@angular/core';
|
|||
});
|
||||
|
||||
it('const enums should be equal', () => {
|
||||
expect(compilerCore.NodeFlags.None).toBe(core.ɵNodeFlags.None);
|
||||
expect(compilerCore.NodeFlags.TypeElement).toBe(core.ɵNodeFlags.TypeElement);
|
||||
expect(compilerCore.NodeFlags.TypeText).toBe(core.ɵNodeFlags.TypeText);
|
||||
expect(compilerCore.NodeFlags.ProjectedTemplate).toBe(core.ɵNodeFlags.ProjectedTemplate);
|
||||
expect(compilerCore.NodeFlags.CatRenderNode).toBe(core.ɵNodeFlags.CatRenderNode);
|
||||
expect(compilerCore.NodeFlags.TypeNgContent).toBe(core.ɵNodeFlags.TypeNgContent);
|
||||
expect(compilerCore.NodeFlags.TypePipe).toBe(core.ɵNodeFlags.TypePipe);
|
||||
expect(compilerCore.NodeFlags.TypePureArray).toBe(core.ɵNodeFlags.TypePureArray);
|
||||
expect(compilerCore.NodeFlags.TypePureObject).toBe(core.ɵNodeFlags.TypePureObject);
|
||||
expect(compilerCore.NodeFlags.TypePurePipe).toBe(core.ɵNodeFlags.TypePurePipe);
|
||||
expect(compilerCore.NodeFlags.CatPureExpression).toBe(core.ɵNodeFlags.CatPureExpression);
|
||||
expect(compilerCore.NodeFlags.TypeValueProvider).toBe(core.ɵNodeFlags.TypeValueProvider);
|
||||
expect(compilerCore.NodeFlags.TypeClassProvider).toBe(core.ɵNodeFlags.TypeClassProvider);
|
||||
expect(compilerCore.NodeFlags.TypeFactoryProvider).toBe(core.ɵNodeFlags.TypeFactoryProvider);
|
||||
expect(compilerCore.NodeFlags.TypeUseExistingProvider)
|
||||
.toBe(core.ɵNodeFlags.TypeUseExistingProvider);
|
||||
expect(compilerCore.NodeFlags.LazyProvider).toBe(core.ɵNodeFlags.LazyProvider);
|
||||
expect(compilerCore.NodeFlags.PrivateProvider).toBe(core.ɵNodeFlags.PrivateProvider);
|
||||
expect(compilerCore.NodeFlags.TypeDirective).toBe(core.ɵNodeFlags.TypeDirective);
|
||||
expect(compilerCore.NodeFlags.Component).toBe(core.ɵNodeFlags.Component);
|
||||
expect(compilerCore.NodeFlags.CatProviderNoDirective)
|
||||
.toBe(core.ɵNodeFlags.CatProviderNoDirective);
|
||||
expect(compilerCore.NodeFlags.CatProvider).toBe(core.ɵNodeFlags.CatProvider);
|
||||
expect(compilerCore.NodeFlags.OnInit).toBe(core.ɵNodeFlags.OnInit);
|
||||
expect(compilerCore.NodeFlags.OnDestroy).toBe(core.ɵNodeFlags.OnDestroy);
|
||||
expect(compilerCore.NodeFlags.DoCheck).toBe(core.ɵNodeFlags.DoCheck);
|
||||
expect(compilerCore.NodeFlags.OnChanges).toBe(core.ɵNodeFlags.OnChanges);
|
||||
expect(compilerCore.NodeFlags.AfterContentInit).toBe(core.ɵNodeFlags.AfterContentInit);
|
||||
expect(compilerCore.NodeFlags.AfterContentChecked).toBe(core.ɵNodeFlags.AfterContentChecked);
|
||||
expect(compilerCore.NodeFlags.AfterViewInit).toBe(core.ɵNodeFlags.AfterViewInit);
|
||||
expect(compilerCore.NodeFlags.AfterViewChecked).toBe(core.ɵNodeFlags.AfterViewChecked);
|
||||
expect(compilerCore.NodeFlags.EmbeddedViews).toBe(core.ɵNodeFlags.EmbeddedViews);
|
||||
expect(compilerCore.NodeFlags.ComponentView).toBe(core.ɵNodeFlags.ComponentView);
|
||||
expect(compilerCore.NodeFlags.TypeContentQuery).toBe(core.ɵNodeFlags.TypeContentQuery);
|
||||
expect(compilerCore.NodeFlags.TypeViewQuery).toBe(core.ɵNodeFlags.TypeViewQuery);
|
||||
expect(compilerCore.NodeFlags.StaticQuery).toBe(core.ɵNodeFlags.StaticQuery);
|
||||
expect(compilerCore.NodeFlags.DynamicQuery).toBe(core.ɵNodeFlags.DynamicQuery);
|
||||
expect(compilerCore.NodeFlags.CatQuery).toBe(core.ɵNodeFlags.CatQuery);
|
||||
expect(compilerCore.NodeFlags.Types).toBe(core.ɵNodeFlags.Types);
|
||||
const expectToBe = (val1: any, val2: any) => expect(val1).toBe(val2);
|
||||
|
||||
expect(compilerCore.DepFlags.None).toBe(core.ɵDepFlags.None);
|
||||
expect(compilerCore.DepFlags.SkipSelf).toBe(core.ɵDepFlags.SkipSelf);
|
||||
expect(compilerCore.DepFlags.Optional).toBe(core.ɵDepFlags.Optional);
|
||||
expect(compilerCore.DepFlags.Value).toBe(core.ɵDepFlags.Value);
|
||||
expectToBe(compilerCore.NodeFlags.None, core.ɵNodeFlags.None);
|
||||
expectToBe(compilerCore.NodeFlags.TypeElement, core.ɵNodeFlags.TypeElement);
|
||||
expectToBe(compilerCore.NodeFlags.TypeText, core.ɵNodeFlags.TypeText);
|
||||
expectToBe(compilerCore.NodeFlags.ProjectedTemplate, core.ɵNodeFlags.ProjectedTemplate);
|
||||
expectToBe(compilerCore.NodeFlags.CatRenderNode, core.ɵNodeFlags.CatRenderNode);
|
||||
expectToBe(compilerCore.NodeFlags.TypeNgContent, core.ɵNodeFlags.TypeNgContent);
|
||||
expectToBe(compilerCore.NodeFlags.TypePipe, core.ɵNodeFlags.TypePipe);
|
||||
expectToBe(compilerCore.NodeFlags.TypePureArray, core.ɵNodeFlags.TypePureArray);
|
||||
expectToBe(compilerCore.NodeFlags.TypePureObject, core.ɵNodeFlags.TypePureObject);
|
||||
expectToBe(compilerCore.NodeFlags.TypePurePipe, core.ɵNodeFlags.TypePurePipe);
|
||||
expectToBe(compilerCore.NodeFlags.CatPureExpression, core.ɵNodeFlags.CatPureExpression);
|
||||
expectToBe(compilerCore.NodeFlags.TypeValueProvider, core.ɵNodeFlags.TypeValueProvider);
|
||||
expectToBe(compilerCore.NodeFlags.TypeClassProvider, core.ɵNodeFlags.TypeClassProvider);
|
||||
expectToBe(compilerCore.NodeFlags.TypeFactoryProvider, core.ɵNodeFlags.TypeFactoryProvider);
|
||||
expectToBe(
|
||||
compilerCore.NodeFlags.TypeUseExistingProvider, core.ɵNodeFlags.TypeUseExistingProvider);
|
||||
expectToBe(compilerCore.NodeFlags.LazyProvider, core.ɵNodeFlags.LazyProvider);
|
||||
expectToBe(compilerCore.NodeFlags.PrivateProvider, core.ɵNodeFlags.PrivateProvider);
|
||||
expectToBe(compilerCore.NodeFlags.TypeDirective, core.ɵNodeFlags.TypeDirective);
|
||||
expectToBe(compilerCore.NodeFlags.Component, core.ɵNodeFlags.Component);
|
||||
expectToBe(
|
||||
compilerCore.NodeFlags.CatProviderNoDirective, core.ɵNodeFlags.CatProviderNoDirective);
|
||||
expectToBe(compilerCore.NodeFlags.CatProvider, core.ɵNodeFlags.CatProvider);
|
||||
expectToBe(compilerCore.NodeFlags.OnInit, core.ɵNodeFlags.OnInit);
|
||||
expectToBe(compilerCore.NodeFlags.OnDestroy, core.ɵNodeFlags.OnDestroy);
|
||||
expectToBe(compilerCore.NodeFlags.DoCheck, core.ɵNodeFlags.DoCheck);
|
||||
expectToBe(compilerCore.NodeFlags.OnChanges, core.ɵNodeFlags.OnChanges);
|
||||
expectToBe(compilerCore.NodeFlags.AfterContentInit, core.ɵNodeFlags.AfterContentInit);
|
||||
expectToBe(compilerCore.NodeFlags.AfterContentChecked, core.ɵNodeFlags.AfterContentChecked);
|
||||
expectToBe(compilerCore.NodeFlags.AfterViewInit, core.ɵNodeFlags.AfterViewInit);
|
||||
expectToBe(compilerCore.NodeFlags.AfterViewChecked, core.ɵNodeFlags.AfterViewChecked);
|
||||
expectToBe(compilerCore.NodeFlags.EmbeddedViews, core.ɵNodeFlags.EmbeddedViews);
|
||||
expectToBe(compilerCore.NodeFlags.ComponentView, core.ɵNodeFlags.ComponentView);
|
||||
expectToBe(compilerCore.NodeFlags.TypeContentQuery, core.ɵNodeFlags.TypeContentQuery);
|
||||
expectToBe(compilerCore.NodeFlags.TypeViewQuery, core.ɵNodeFlags.TypeViewQuery);
|
||||
expectToBe(compilerCore.NodeFlags.StaticQuery, core.ɵNodeFlags.StaticQuery);
|
||||
expectToBe(compilerCore.NodeFlags.DynamicQuery, core.ɵNodeFlags.DynamicQuery);
|
||||
expectToBe(compilerCore.NodeFlags.CatQuery, core.ɵNodeFlags.CatQuery);
|
||||
expectToBe(compilerCore.NodeFlags.Types, core.ɵNodeFlags.Types);
|
||||
|
||||
expect(compilerCore.InjectFlags.Default).toBe(core.InjectFlags.Default);
|
||||
expect(compilerCore.InjectFlags.SkipSelf).toBe(core.InjectFlags.SkipSelf);
|
||||
expect(compilerCore.InjectFlags.Self).toBe(core.InjectFlags.Self);
|
||||
expectToBe(compilerCore.DepFlags.None, core.ɵDepFlags.None);
|
||||
expectToBe(compilerCore.DepFlags.SkipSelf, core.ɵDepFlags.SkipSelf);
|
||||
expectToBe(compilerCore.DepFlags.Optional, core.ɵDepFlags.Optional);
|
||||
expectToBe(compilerCore.DepFlags.Value, core.ɵDepFlags.Value);
|
||||
|
||||
expect(compilerCore.ArgumentType.Inline).toBe(core.ɵArgumentType.Inline);
|
||||
expect(compilerCore.ArgumentType.Dynamic).toBe(core.ɵArgumentType.Dynamic);
|
||||
expectToBe(compilerCore.InjectFlags.Default, core.InjectFlags.Default);
|
||||
expectToBe(compilerCore.InjectFlags.SkipSelf, core.InjectFlags.SkipSelf);
|
||||
expectToBe(compilerCore.InjectFlags.Self, core.InjectFlags.Self);
|
||||
|
||||
expect(compilerCore.BindingFlags.TypeElementAttribute)
|
||||
.toBe(core.ɵBindingFlags.TypeElementAttribute);
|
||||
expect(compilerCore.BindingFlags.TypeElementClass).toBe(core.ɵBindingFlags.TypeElementClass);
|
||||
expect(compilerCore.BindingFlags.TypeElementStyle).toBe(core.ɵBindingFlags.TypeElementStyle);
|
||||
expect(compilerCore.BindingFlags.TypeProperty).toBe(core.ɵBindingFlags.TypeProperty);
|
||||
expect(compilerCore.BindingFlags.SyntheticProperty)
|
||||
.toBe(core.ɵBindingFlags.SyntheticProperty);
|
||||
expect(compilerCore.BindingFlags.SyntheticHostProperty)
|
||||
.toBe(core.ɵBindingFlags.SyntheticHostProperty);
|
||||
expect(compilerCore.BindingFlags.CatSyntheticProperty)
|
||||
.toBe(core.ɵBindingFlags.CatSyntheticProperty);
|
||||
expect(compilerCore.BindingFlags.Types).toBe(core.ɵBindingFlags.Types);
|
||||
|
||||
expect(compilerCore.QueryBindingType.First).toBe(core.ɵQueryBindingType.First);
|
||||
expect(compilerCore.QueryBindingType.All).toBe(core.ɵQueryBindingType.All);
|
||||
expectToBe(compilerCore.ArgumentType.Inline, core.ɵArgumentType.Inline);
|
||||
expectToBe(compilerCore.ArgumentType.Dynamic, core.ɵArgumentType.Dynamic);
|
||||
|
||||
expect(compilerCore.QueryValueType.ElementRef).toBe(core.ɵQueryValueType.ElementRef);
|
||||
expect(compilerCore.QueryValueType.RenderElement).toBe(core.ɵQueryValueType.RenderElement);
|
||||
expect(compilerCore.QueryValueType.TemplateRef).toBe(core.ɵQueryValueType.TemplateRef);
|
||||
expect(compilerCore.QueryValueType.ViewContainerRef)
|
||||
.toBe(core.ɵQueryValueType.ViewContainerRef);
|
||||
expect(compilerCore.QueryValueType.Provider).toBe(core.ɵQueryValueType.Provider);
|
||||
expectToBe(
|
||||
compilerCore.BindingFlags.TypeElementAttribute, core.ɵBindingFlags.TypeElementAttribute);
|
||||
expectToBe(compilerCore.BindingFlags.TypeElementClass, core.ɵBindingFlags.TypeElementClass);
|
||||
expectToBe(compilerCore.BindingFlags.TypeElementStyle, core.ɵBindingFlags.TypeElementStyle);
|
||||
expectToBe(compilerCore.BindingFlags.TypeProperty, core.ɵBindingFlags.TypeProperty);
|
||||
expectToBe(compilerCore.BindingFlags.SyntheticProperty, core.ɵBindingFlags.SyntheticProperty);
|
||||
expectToBe(
|
||||
compilerCore.BindingFlags.SyntheticHostProperty,
|
||||
core.ɵBindingFlags.SyntheticHostProperty);
|
||||
expectToBe(
|
||||
compilerCore.BindingFlags.CatSyntheticProperty, core.ɵBindingFlags.CatSyntheticProperty);
|
||||
expectToBe(compilerCore.BindingFlags.Types, core.ɵBindingFlags.Types);
|
||||
|
||||
expect(compilerCore.ViewFlags.None).toBe(core.ɵViewFlags.None);
|
||||
expect(compilerCore.ViewFlags.OnPush).toBe(core.ɵViewFlags.OnPush);
|
||||
expectToBe(compilerCore.QueryBindingType.First, core.ɵQueryBindingType.First);
|
||||
expectToBe(compilerCore.QueryBindingType.All, core.ɵQueryBindingType.All);
|
||||
|
||||
expectToBe(compilerCore.QueryValueType.ElementRef, core.ɵQueryValueType.ElementRef);
|
||||
expectToBe(compilerCore.QueryValueType.RenderElement, core.ɵQueryValueType.RenderElement);
|
||||
expectToBe(compilerCore.QueryValueType.TemplateRef, core.ɵQueryValueType.TemplateRef);
|
||||
expectToBe(
|
||||
compilerCore.QueryValueType.ViewContainerRef, core.ɵQueryValueType.ViewContainerRef);
|
||||
expectToBe(compilerCore.QueryValueType.Provider, core.ɵQueryValueType.Provider);
|
||||
|
||||
expectToBe(compilerCore.ViewFlags.None, core.ɵViewFlags.None);
|
||||
expectToBe(compilerCore.ViewFlags.OnPush, core.ɵViewFlags.OnPush);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ import {CssLexer, CssLexerMode, CssToken, CssTokenType, cssScannerError, getRawM
|
|||
it('should throw an error if a selector is being parsed while in the wrong mode', () => {
|
||||
const cssCode = '.class > tag';
|
||||
|
||||
let capturedMessage: string = undefined !;
|
||||
let capturedMessage: string|null = null;
|
||||
try {
|
||||
tokenize(cssCode, false, CssLexerMode.STYLE_BLOCK);
|
||||
} catch (e) {
|
||||
|
@ -282,8 +282,8 @@ import {CssLexer, CssLexerMode, CssToken, CssTokenType, cssScannerError, getRawM
|
|||
}
|
||||
|
||||
expect(capturedMessage).toMatch(/Unexpected character \[\>\] at column 0:7 in expression/g);
|
||||
capturedMessage = null !;
|
||||
|
||||
capturedMessage = null;
|
||||
try {
|
||||
tokenize(cssCode, false, CssLexerMode.SELECTOR);
|
||||
} catch (e) {
|
||||
|
|
|
@ -170,21 +170,22 @@ function _getCaptureAst(capture: any[], index = 0): CssAst {
|
|||
expect(captures.length).toEqual(3);
|
||||
|
||||
const rule1 = <CssSelectorRuleAst>_getCaptureAst(captures, 0);
|
||||
expect(rule1).toEqual(ast.rules[0]);
|
||||
expect(rule1).toEqual(ast.rules[0] as CssSelectorRuleAst);
|
||||
|
||||
const firstSelector = rule1.selectors[0];
|
||||
const firstSimpleSelector = firstSelector.selectorParts[0];
|
||||
_assertTokens(firstSimpleSelector.tokens, ['.', 'rule1']);
|
||||
|
||||
const rule2 = <CssSelectorRuleAst>_getCaptureAst(captures, 1);
|
||||
expect(rule2).toEqual(ast.rules[1]);
|
||||
expect(rule2).toEqual(ast.rules[1] as CssSelectorRuleAst);
|
||||
|
||||
const secondSelector = rule2.selectors[0];
|
||||
const secondSimpleSelector = secondSelector.selectorParts[0];
|
||||
_assertTokens(secondSimpleSelector.tokens, ['.', 'rule2']);
|
||||
|
||||
const rule3 = <CssSelectorRuleAst>_getCaptureAst(captures, 2);
|
||||
expect(rule3).toEqual((<CssMediaQueryRuleAst>ast.rules[2]).block.entries[0]);
|
||||
expect(rule3).toEqual(
|
||||
(ast.rules[2] as CssSelectorRuleAst).block.entries[0] as CssSelectorRuleAst);
|
||||
|
||||
const thirdSelector = rule3.selectors[0];
|
||||
const thirdSimpleSelector = thirdSelector.selectorParts[0];
|
||||
|
|
|
@ -547,7 +547,7 @@ function fakeNoTranslate(
|
|||
|
||||
function extract(
|
||||
html: string, implicitTags: string[] = [],
|
||||
implicitAttrs: {[k: string]: string[]} = {}): [string[], string, string][] {
|
||||
implicitAttrs: {[k: string]: string[]} = {}): [string[], string, string, string][] {
|
||||
const result =
|
||||
extractMessages(parseHtml(html), DEFAULT_INTERPOLATION_CONFIG, implicitTags, implicitAttrs);
|
||||
|
||||
|
@ -558,7 +558,7 @@ function extract(
|
|||
// clang-format off
|
||||
// https://github.com/angular/clang-format/issues/35
|
||||
return result.messages.map(
|
||||
message => [serializeI18nNodes(message.nodes), message.meaning, message.description, message.id]) as [string[], string, string][];
|
||||
message => [serializeI18nNodes(message.nodes), message.meaning, message.description, message.id]) as [string[], string, string, string][];
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
|
|
|
@ -116,9 +116,10 @@ function expectMap(
|
|||
const sm = ctx.toSourceMapGenerator('o.ts').toJSON() !;
|
||||
const genPosition = {line: genLine + 1, column: genCol};
|
||||
const origPosition = originalPositionFor(sm, genPosition);
|
||||
expect(origPosition.source).toEqual(source);
|
||||
expect(origPosition.line).toEqual(srcLine === null ? null : srcLine + 1);
|
||||
expect(origPosition.column).toEqual(srcCol);
|
||||
// TODO: Review use of `any` here (#19904)
|
||||
expect(origPosition.source as any).toEqual(source);
|
||||
expect(origPosition.line as any).toEqual(srcLine === null ? null : srcLine + 1);
|
||||
expect(origPosition.column as any).toEqual(srcCol);
|
||||
}
|
||||
|
||||
// returns the number of segments per line
|
||||
|
|
|
@ -36,4 +36,4 @@ export function extractSourceMap(source: string): SourceMap|null {
|
|||
|
||||
function decodeB64String(s: string): string {
|
||||
return b64.toByteArray(s).reduce((s: string, c: number) => s + String.fromCharCode(c), '');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,13 @@ import {ComponentFixture, TestBed, fakeAsync, tick} from '@angular/core/testing'
|
|||
let resourceLoader: MockResourceLoader;
|
||||
|
||||
beforeEach(() => {
|
||||
// Jasmine relies on methods on `Function.prototype`, so restore the prototype on the spy.
|
||||
// Work around for: https://github.com/jasmine/jasmine/issues/1573
|
||||
// TODO: Figure out a better way to retrieve the JIT sources, without spying on `Function`.
|
||||
const originalProto = ɵglobal.Function.prototype;
|
||||
jitSpy = spyOn(ɵglobal, 'Function').and.callThrough();
|
||||
ɵglobal.Function.prototype = originalProto;
|
||||
|
||||
resourceLoader = new MockResourceLoader();
|
||||
TestBed.configureCompiler({providers: [{provide: ResourceLoader, useValue: resourceLoader}]});
|
||||
});
|
||||
|
|
|
@ -35,12 +35,13 @@ function mockSystem(modules: {[module: string]: any}) {
|
|||
|
||||
it('loads a default factory by appending the factory suffix', async(() => {
|
||||
const loader = new SystemJsNgModuleLoader(new Compiler());
|
||||
loader.load('test').then(contents => { expect(contents).toBe('test module factory'); });
|
||||
loader.load('test').then(
|
||||
contents => { expect(contents).toBe('test module factory' as any); });
|
||||
}));
|
||||
it('loads a named factory by appending the factory suffix', async(() => {
|
||||
const loader = new SystemJsNgModuleLoader(new Compiler());
|
||||
loader.load('test#Named').then(contents => {
|
||||
expect(contents).toBe('test NamedNgFactory');
|
||||
expect(contents).toBe('test NamedNgFactory' as any);
|
||||
});
|
||||
}));
|
||||
it('loads a named factory with a configured prefix and suffix', async(() => {
|
||||
|
@ -49,7 +50,7 @@ function mockSystem(modules: {[module: string]: any}) {
|
|||
factoryPathSuffix: '/suffixed',
|
||||
});
|
||||
loader.load('test#Named').then(contents => {
|
||||
expect(contents).toBe('test module factory');
|
||||
expect(contents).toBe('test module factory' as any);
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -315,7 +315,7 @@ class TestObj {
|
|||
// But we should still get an array of the right length based on function.length.
|
||||
expect(reflector.parameters(ChildWithCtorNoDecorator)).toEqual([
|
||||
undefined, undefined, undefined
|
||||
]);
|
||||
] as any[]); // TODO: Review use of `any` here (#19904)
|
||||
|
||||
expect(reflector.parameters(NoDecorators)).toEqual([]);
|
||||
expect(reflector.parameters(<any>{})).toEqual([]);
|
||||
|
|
|
@ -1203,8 +1203,8 @@ describe('di', () => {
|
|||
describe('@Attribute', () => {
|
||||
|
||||
it('should inject attribute', () => {
|
||||
let exist: string|undefined = 'wrong';
|
||||
let nonExist: string|undefined = 'wrong';
|
||||
let exist = 'wrong' as string | undefined;
|
||||
let nonExist = 'wrong' as string | undefined;
|
||||
|
||||
const MyApp = createComponent('my-app', function(rf: RenderFlags, ctx: any) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
|
@ -1221,8 +1221,8 @@ describe('di', () => {
|
|||
|
||||
// https://stackblitz.com/edit/angular-8ytqkp?file=src%2Fapp%2Fapp.component.ts
|
||||
it('should not inject attributes representing bindings and outputs', () => {
|
||||
let exist: string|undefined = 'wrong';
|
||||
let nonExist: string|undefined = 'wrong';
|
||||
let exist = 'wrong' as string | undefined;
|
||||
let nonExist = 'wrong' as string | undefined;
|
||||
|
||||
const MyApp = createComponent('my-app', function(rf: RenderFlags, ctx: any) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
|
@ -1238,8 +1238,8 @@ describe('di', () => {
|
|||
});
|
||||
|
||||
it('should not accidentally inject attributes representing bindings and outputs', () => {
|
||||
let exist: string|undefined = 'wrong';
|
||||
let nonExist: string|undefined = 'wrong';
|
||||
let exist = 'wrong' as string | undefined;
|
||||
let nonExist = 'wrong' as string | undefined;
|
||||
|
||||
const MyApp = createComponent('my-app', function(rf: RenderFlags, ctx: any) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
|
@ -1415,7 +1415,7 @@ describe('di', () => {
|
|||
// so that we have smaller HelloWorld.
|
||||
(parent.tNode as{parent: any}).parent = undefined;
|
||||
|
||||
const injector = getOrCreateNodeInjector();
|
||||
const injector: any = getOrCreateNodeInjector(); // TODO: Review use of `any` here (#19904)
|
||||
expect(injector).not.toBe(null);
|
||||
} finally {
|
||||
leaveView(oldView);
|
||||
|
|
|
@ -259,7 +259,7 @@ describe('NgOnChangesFeature', () => {
|
|||
|
||||
it('correctly computes firstChange', () => {
|
||||
class MyDirective implements OnChanges {
|
||||
public log: Array<string|SimpleChange> = [];
|
||||
public log: Array<string|SimpleChange|undefined> = [];
|
||||
public valA: string = 'initValue';
|
||||
// TODO(issue/24571): remove '!'.
|
||||
public valB !: string;
|
||||
|
|
|
@ -112,7 +112,7 @@ describe('elementProperty', () => {
|
|||
|
||||
class OtherDir {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
id !: boolean;
|
||||
id !: number;
|
||||
clickStream = new EventEmitter();
|
||||
|
||||
static ngDirectiveDef = defineDirective({
|
||||
|
@ -138,7 +138,7 @@ describe('elementProperty', () => {
|
|||
|
||||
class IdDir {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
idNumber !: number;
|
||||
idNumber !: string;
|
||||
|
||||
static ngDirectiveDef = defineDirective({
|
||||
type: IdDir,
|
||||
|
@ -347,15 +347,14 @@ describe('elementProperty', () => {
|
|||
}
|
||||
}
|
||||
|
||||
expect(renderToHtml(Template, {condition: true, id1: 'one', id2: 'two', id3: 'three'}, deps))
|
||||
expect(renderToHtml(Template, {condition: true, id1: 'one', id2: 'two', id3: 3}, deps))
|
||||
.toEqual(`<button iddir="">Click me</button><button id="two">Click me too</button>`);
|
||||
expect(idDir !.idNumber).toEqual('one');
|
||||
|
||||
expect(
|
||||
renderToHtml(Template, {condition: false, id1: 'four', id2: 'two', id3: 'three'}, deps))
|
||||
expect(renderToHtml(Template, {condition: false, id1: 'four', id2: 'two', id3: 3}, deps))
|
||||
.toEqual(`<button iddir="">Click me</button><button otherdir="">Click me too</button>`);
|
||||
expect(idDir !.idNumber).toEqual('four');
|
||||
expect(otherDir !.id).toEqual('three');
|
||||
expect(otherDir !.id).toEqual(3);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -293,11 +293,11 @@ describe('array literals', () => {
|
|||
const e0_ff =
|
||||
(v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any,
|
||||
v8: any) => ['start', v0, v1, v2, v3, v4, v5, v6, v7, v8, 'end'];
|
||||
const e0_ff_1 = (v: any) => { return {name: v}; };
|
||||
const e0_ff_1 = (v: any) => `modified_${v}`;
|
||||
|
||||
renderToHtml(Template, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'], directives);
|
||||
/**
|
||||
* <my-comp [names]="['start', v0, v1, v2, v3, {name: v4}, v5, v6, v7, v8, 'end']">
|
||||
* <my-comp [names]="['start', v0, v1, v2, v3, `modified_${v4}`, v5, v6, v7, v8, 'end']">
|
||||
* </my-comp>
|
||||
*/
|
||||
function Template(rf: RenderFlags, c: any) {
|
||||
|
@ -315,17 +315,17 @@ describe('array literals', () => {
|
|||
}
|
||||
|
||||
expect(myComp !.names).toEqual([
|
||||
'start', 'a', 'b', 'c', 'd', {name: 'e'}, 'f', 'g', 'h', 'i', 'end'
|
||||
'start', 'a', 'b', 'c', 'd', 'modified_e', 'f', 'g', 'h', 'i', 'end'
|
||||
]);
|
||||
|
||||
renderToHtml(Template, ['a1', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'], directives);
|
||||
expect(myComp !.names).toEqual([
|
||||
'start', 'a1', 'b', 'c', 'd', {name: 'e'}, 'f', 'g', 'h', 'i', 'end'
|
||||
'start', 'a1', 'b', 'c', 'd', 'modified_e', 'f', 'g', 'h', 'i', 'end'
|
||||
]);
|
||||
|
||||
renderToHtml(Template, ['a1', 'b', 'c', 'd', 'e5', 'f', 'g', 'h', 'i'], directives);
|
||||
expect(myComp !.names).toEqual([
|
||||
'start', 'a1', 'b', 'c', 'd', {name: 'e5'}, 'f', 'g', 'h', 'i', 'end'
|
||||
'start', 'a1', 'b', 'c', 'd', 'modified_e5', 'f', 'g', 'h', 'i', 'end'
|
||||
]);
|
||||
});
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import {callMostRecentEventListenerHandler, compViewDef, createAndGetRootNodes,
|
|||
* We map addEventListener to the Zones internal name. This is because we want to be fast
|
||||
* and bypass the zone bookkeeping. We know that we can do the bookkeeping faster.
|
||||
*/
|
||||
const addEventListener = '__zone_symbol__addEventListener';
|
||||
const addEventListener = '__zone_symbol__addEventListener' as 'addEventListener';
|
||||
|
||||
{
|
||||
describe(`Component Views`, () => {
|
||||
|
|
|
@ -20,8 +20,8 @@ import {ARG_TYPE_VALUES, callMostRecentEventListenerHandler, checkNodeInlineOrDy
|
|||
* We map addEventListener to the Zones internal name. This is because we want to be fast
|
||||
* and bypass the zone bookkeeping. We know that we can do the bookkeeping faster.
|
||||
*/
|
||||
const addEventListener = '__zone_symbol__addEventListener';
|
||||
const removeEventListener = '__zone_symbol__removeEventListener';
|
||||
const addEventListener = '__zone_symbol__addEventListener' as 'addEventListener';
|
||||
const removeEventListener = '__zone_symbol__removeEventListener' as 'removeEventListener';
|
||||
|
||||
{
|
||||
describe(`View Elements`, () => {
|
||||
|
|
|
@ -23,7 +23,7 @@ export const proxy: ClassDecorator = (t: any) => t;
|
|||
const _global = <any>(typeof window === 'undefined' ? global : window);
|
||||
|
||||
export const afterEach: Function = _global.afterEach;
|
||||
export const expect: (actual: any) => jasmine.Matchers = _global.expect;
|
||||
export const expect: <T>(actual: T) => jasmine.Matchers<T> = _global.expect;
|
||||
|
||||
const jsmBeforeEach = _global.beforeEach;
|
||||
const jsmDescribe = _global.describe;
|
||||
|
|
|
@ -15,7 +15,7 @@ describe('testability example', () => {
|
|||
describe('using task tracking', () => {
|
||||
const URL = '/core/testability/ts/whenStable/';
|
||||
|
||||
it('times out with a list of tasks', (done) => {
|
||||
it('times out with a list of tasks', (done: DoneFn) => {
|
||||
browser.get(URL);
|
||||
browser.ignoreSynchronization = true;
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
"rxjs/*": ["../../node_modules/rxjs/*"]
|
||||
},
|
||||
"outDir": "../../dist/examples",
|
||||
"types": ["jasmine", "node", "angular", "systemjs"]
|
||||
"types": ["angular"]
|
||||
},
|
||||
|
||||
"include": [
|
||||
"./**/*.ts",
|
||||
"../../node_modules/zone.js/dist/zone.js.d.ts",
|
||||
// TODO(i): we can't use protractor's built-in typings because they contain lots of ambient definitions
|
||||
"../../node_modules/@types/protractor/index.d.ts"
|
||||
"../../node_modules/@types/jasminewd2/index.d.ts",
|
||||
"../../tools/types-ext/jasminewd2.d.ts",
|
||||
"../types.d.ts",
|
||||
"**/*.ts"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// WARNING:
|
||||
// This file is used to build the e2e tests only.
|
||||
// The rest of the files are included in `/packages/tsconfig.json`.
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
},
|
||||
|
||||
"include": [
|
||||
"../../node_modules/@types/jasminewd2/index.d.ts",
|
||||
"../../tools/types-ext/jasminewd2.d.ts",
|
||||
"../types.d.ts",
|
||||
"**/e2e_test/*"
|
||||
],
|
||||
|
||||
"exclude": []
|
||||
}
|
|
@ -50,4 +50,4 @@ describe('upgrade/static (full)', () => {
|
|||
firstHero = element.all(by.css('ng1-hero')).get(0);
|
||||
expect(firstHero.element(by.css('h2')).getText()).toEqual('Wonder Woman');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ import {ElementFinder, by} from 'protractor';
|
|||
|
||||
declare global {
|
||||
namespace jasmine {
|
||||
interface Matchers {
|
||||
interface Matchers<T> {
|
||||
toBeAHero(): Promise<void>;
|
||||
toHaveName(exectedName: string): Promise<void>;
|
||||
}
|
||||
|
|
|
@ -92,14 +92,14 @@ function asyncValidator(expected: any, timeout = 0) {
|
|||
});
|
||||
|
||||
it('should return custom accessor when provided', () => {
|
||||
const customAccessor = new SpyValueAccessor();
|
||||
const customAccessor: ControlValueAccessor = new SpyValueAccessor() as any;
|
||||
const checkboxAccessor = new CheckboxControlValueAccessor(null !, null !);
|
||||
expect(selectValueAccessor(dir, <any>[defaultAccessor, customAccessor, checkboxAccessor]))
|
||||
.toEqual(customAccessor);
|
||||
});
|
||||
|
||||
it('should return custom accessor when provided with select multiple', () => {
|
||||
const customAccessor = new SpyValueAccessor();
|
||||
const customAccessor: ControlValueAccessor = new SpyValueAccessor() as any;
|
||||
const selectMultipleAccessor = new SelectMultipleControlValueAccessor(null !, null !);
|
||||
expect(selectValueAccessor(
|
||||
dir, <any>[defaultAccessor, customAccessor, selectMultipleAccessor]))
|
||||
|
|
|
@ -207,7 +207,7 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec';
|
|||
fixture.detectChanges();
|
||||
|
||||
emailInput = fixture.debugElement.query(By.css('[formControlName="email"]'));
|
||||
expect(emailInput).toBe(null);
|
||||
expect(emailInput as any).toBe(null); // TODO: Review use of `any` here (#19904)
|
||||
});
|
||||
|
||||
it('should strip array controls that are not found', () => {
|
||||
|
@ -1393,7 +1393,7 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec';
|
|||
fixture.componentInstance.form = formGroup;
|
||||
fixture.detectChanges();
|
||||
|
||||
const values: string[] = [];
|
||||
const values: any[] = [];
|
||||
const streams = merge(
|
||||
control.valueChanges, control.statusChanges, formGroup.valueChanges,
|
||||
formGroup.statusChanges);
|
||||
|
@ -1430,7 +1430,7 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec';
|
|||
fixture.componentInstance.form = formGroup;
|
||||
fixture.detectChanges();
|
||||
|
||||
const values: string[] = [];
|
||||
const values: (string | {[key: string]: string})[] = [];
|
||||
const streams = merge(
|
||||
control.valueChanges, control.statusChanges, formGroup.valueChanges,
|
||||
formGroup.statusChanges);
|
||||
|
|
|
@ -460,7 +460,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
|||
fixture.detectChanges();
|
||||
tick();
|
||||
|
||||
const values: string[] = [];
|
||||
const values: any[] = [];
|
||||
const form = fixture.debugElement.children[0].injector.get(NgForm);
|
||||
|
||||
const sub = merge(form.valueChanges !, form.statusChanges !)
|
||||
|
@ -748,7 +748,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
|||
|
||||
it('should reset properly', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelForm);
|
||||
fixture.componentInstance.name = 'Nancy';
|
||||
fixture.componentInstance.name = 'Nancy' as string | null;
|
||||
fixture.componentInstance.options = {updateOn: 'submit'};
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
|
@ -792,7 +792,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
|||
fixture.detectChanges();
|
||||
tick();
|
||||
|
||||
const values: string[] = [];
|
||||
const values: any[] = [];
|
||||
const form = fixture.debugElement.children[0].injector.get(NgForm);
|
||||
|
||||
const sub = merge(form.valueChanges !, form.statusChanges !)
|
||||
|
@ -1028,7 +1028,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
|||
|
||||
it('should reset the form to empty when reset event is fired', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelForm);
|
||||
fixture.componentInstance.name = 'should be cleared';
|
||||
fixture.componentInstance.name = 'should be cleared' as string | null;
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
|
||||
|
@ -1654,7 +1654,7 @@ class StandaloneNgModel {
|
|||
})
|
||||
class NgModelForm {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
name !: string;
|
||||
name !: string | null;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
event !: Event;
|
||||
options = {};
|
||||
|
|
|
@ -327,7 +327,7 @@ import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util'
|
|||
const fixture = initTest(NgModelSelectWithNullForm);
|
||||
const comp = fixture.componentInstance;
|
||||
comp.cities = [{'name': 'SF'}, {'name': 'NYC'}];
|
||||
comp.selectedCity = null !;
|
||||
comp.selectedCity = null;
|
||||
fixture.detectChanges();
|
||||
|
||||
const select = fixture.debugElement.query(By.css('select'));
|
||||
|
@ -336,7 +336,7 @@ import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util'
|
|||
dispatchEvent(select.nativeElement, 'change');
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
expect(comp.selectedCity['name']).toEqual('NYC');
|
||||
expect(comp.selectedCity !['name']).toEqual('NYC');
|
||||
|
||||
select.nativeElement.value = '0: null';
|
||||
dispatchEvent(select.nativeElement, 'change');
|
||||
|
@ -1231,7 +1231,7 @@ class NgModelSelectForm {
|
|||
`
|
||||
})
|
||||
class NgModelSelectWithNullForm {
|
||||
selectedCity: {[k: string]: string} = {};
|
||||
selectedCity: {[k: string]: string}|null = {};
|
||||
cities: any[] = [];
|
||||
}
|
||||
|
||||
|
|
|
@ -80,14 +80,14 @@ import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
|
|||
it('supports setting and accessing value \'false\' via get', () => {
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
transferState.set(TEST_KEY, false);
|
||||
expect(transferState.get(TEST_KEY, 20)).toBe(false);
|
||||
expect(transferState.get(TEST_KEY, true)).toBe(false);
|
||||
expect(transferState.hasKey(TEST_KEY)).toBe(true);
|
||||
});
|
||||
|
||||
it('supports setting and accessing value \'null\' via get', () => {
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
transferState.set(TEST_KEY, null);
|
||||
expect(transferState.get(TEST_KEY, 20)).toBe(null);
|
||||
expect(transferState.get(TEST_KEY, 20 as any)).toBe(null);
|
||||
expect(transferState.hasKey(TEST_KEY)).toBe(true);
|
||||
});
|
||||
|
||||
|
@ -130,4 +130,4 @@ import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
|
|||
expect(unescapedObj['testString']).toBe(testString);
|
||||
});
|
||||
});
|
||||
})();
|
||||
})();
|
||||
|
|
|
@ -809,7 +809,7 @@ class CompWithUrlTemplate {
|
|||
|
||||
describe('errors', () => {
|
||||
let originalJasmineIt: (description: string, func: () => void) => jasmine.Spec;
|
||||
let originalJasmineBeforeEach: (beforeEachFunction: () => void) => void;
|
||||
let originalJasmineBeforeEach: (beforeEachFunction: (done: DoneFn) => void) => void;
|
||||
|
||||
const patchJasmineIt = () => {
|
||||
let resolve: (result: any) => void;
|
||||
|
|
|
@ -15,7 +15,7 @@ import {ɵgetDOM as getDOM} from '@angular/platform-browser';
|
|||
/**
|
||||
* Jasmine matchers that check Angular specific conditions.
|
||||
*/
|
||||
export interface NgMatchers extends jasmine.Matchers {
|
||||
export interface NgMatchers extends jasmine.Matchers<any> {
|
||||
/**
|
||||
* Expect the value to be a `Promise`.
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {PRIMARY_OUTLET, ParamMap, convertToParamMap} from './shared';
|
||||
import {PRIMARY_OUTLET, ParamMap, Params, convertToParamMap} from './shared';
|
||||
import {forEach, shallowEqual} from './utils/collection';
|
||||
|
||||
export function createEmptyUrlTree() {
|
||||
|
@ -23,8 +23,8 @@ export function containsTree(container: UrlTree, containee: UrlTree, exact: bool
|
|||
containsSegmentGroup(container.root, containee.root);
|
||||
}
|
||||
|
||||
function equalQueryParams(
|
||||
container: {[k: string]: string}, containee: {[k: string]: string}): boolean {
|
||||
function equalQueryParams(container: Params, containee: Params): boolean {
|
||||
// TODO: This does not handle array params correctly.
|
||||
return shallowEqual(container, containee);
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,8 @@ function equalSegmentGroups(container: UrlSegmentGroup, containee: UrlSegmentGro
|
|||
return true;
|
||||
}
|
||||
|
||||
function containsQueryParams(
|
||||
container: {[k: string]: string}, containee: {[k: string]: string}): boolean {
|
||||
function containsQueryParams(container: Params, containee: Params): boolean {
|
||||
// TODO: This does not handle array params correctly.
|
||||
return Object.keys(containee).length <= Object.keys(container).length &&
|
||||
Object.keys(containee).every(key => containee[key] === container[key]);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ export class UrlTree {
|
|||
/** The root segment group of the URL tree */
|
||||
public root: UrlSegmentGroup,
|
||||
/** The query params of the URL */
|
||||
public queryParams: {[key: string]: string},
|
||||
public queryParams: Params,
|
||||
/** The fragment of the URL */
|
||||
public fragment: string|null) {}
|
||||
|
||||
|
@ -446,8 +446,8 @@ class UrlParser {
|
|||
return new UrlSegmentGroup([], this.parseChildren());
|
||||
}
|
||||
|
||||
parseQueryParams(): {[key: string]: any} {
|
||||
const params: {[key: string]: any} = {};
|
||||
parseQueryParams(): Params {
|
||||
const params: Params = {};
|
||||
if (this.consumeOptional('?')) {
|
||||
do {
|
||||
this.parseQueryParam(params);
|
||||
|
@ -534,7 +534,7 @@ class UrlParser {
|
|||
}
|
||||
|
||||
// Parse a single query parameter `name[=value]`
|
||||
private parseQueryParam(params: {[key: string]: any}): void {
|
||||
private parseQueryParam(params: Params): void {
|
||||
const key = matchQueryParams(this.remaining);
|
||||
if (!key) {
|
||||
return;
|
||||
|
|
|
@ -210,7 +210,7 @@ describe('bootstrap', () => {
|
|||
|
||||
platformBrowserDynamic([]).bootstrapModule(TestModule).then(res => {
|
||||
const router = res.injector.get(Router);
|
||||
spyOn(router, 'resetRootComponentType').and.callThrough();
|
||||
spyOn(router as any, 'resetRootComponentType').and.callThrough();
|
||||
|
||||
const appRef: ApplicationRef = res.injector.get(ApplicationRef);
|
||||
appRef.bootstrap(SecondRootCmp);
|
||||
|
@ -236,7 +236,7 @@ describe('bootstrap', () => {
|
|||
|
||||
platformBrowserDynamic([]).bootstrapModule(TestModule).then(res => {
|
||||
const router = res.injector.get(Router);
|
||||
spyOn(router, 'resetRootComponentType').and.callThrough();
|
||||
spyOn(router as any, 'resetRootComponentType').and.callThrough();
|
||||
|
||||
const appRef: ApplicationRef = res.injector.get(ApplicationRef);
|
||||
appRef.components[0].onDestroy(() => {
|
||||
|
|
|
@ -131,7 +131,7 @@ function checkActivatedRoute(
|
|||
if (actual === null) {
|
||||
expect(actual).toBeDefined();
|
||||
} else {
|
||||
expect(actual.component).toBe(cmp);
|
||||
expect(actual.component as any).toBe(cmp);
|
||||
expect(actual.outlet).toEqual(outlet);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -799,7 +799,7 @@ function checkActivatedRoute(
|
|||
} else {
|
||||
expect(actual.url.map(s => s.path).join('/')).toEqual(url);
|
||||
expect(actual.params).toEqual(params);
|
||||
expect(actual.component).toBe(cmp);
|
||||
expect(actual.component as any).toBe(cmp);
|
||||
expect(actual.outlet).toEqual(outlet);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
import {Location} from '@angular/common';
|
||||
import {TestBed, inject} from '@angular/core/testing';
|
||||
|
||||
import {ResolveData} from '../src/config';
|
||||
import {Routes} from '../src/config';
|
||||
import {ChildActivationStart} from '../src/events';
|
||||
import {PreActivation} from '../src/pre_activation';
|
||||
import {Router} from '../src/router';
|
||||
import {ChildrenOutletContexts} from '../src/router_outlet_context';
|
||||
import {ActivatedRouteSnapshot, RouterStateSnapshot, createEmptyStateSnapshot} from '../src/router_state';
|
||||
import {RouterStateSnapshot, createEmptyStateSnapshot} from '../src/router_state';
|
||||
import {DefaultUrlSerializer} from '../src/url_tree';
|
||||
import {TreeNode} from '../src/utils/tree';
|
||||
import {RouterTestingModule} from '../testing/src/router_testing_module';
|
||||
|
@ -30,14 +30,17 @@ describe('Router', () => {
|
|||
|
||||
it('should copy config to avoid mutations of user-provided objects', () => {
|
||||
const r: Router = TestBed.get(Router);
|
||||
const configs = [{
|
||||
const configs: Routes = [{
|
||||
path: 'a',
|
||||
component: TestComponent,
|
||||
children: [{path: 'b', component: TestComponent}, {path: 'c', component: TestComponent}]
|
||||
}];
|
||||
const children = configs[0].children !;
|
||||
|
||||
r.resetConfig(configs);
|
||||
|
||||
let rConfigs = r.config;
|
||||
const rConfigs = r.config;
|
||||
const rChildren = rConfigs[0].children !;
|
||||
|
||||
// routes array and shallow copy
|
||||
expect(configs).not.toBe(rConfigs);
|
||||
|
@ -46,11 +49,11 @@ describe('Router', () => {
|
|||
expect(configs[0].component).toBe(rConfigs[0].component);
|
||||
|
||||
// children should be new array and routes shallow copied
|
||||
expect(configs[0].children).not.toBe(rConfigs[0].children);
|
||||
expect(configs[0].children[0]).not.toBe(rConfigs[0].children ![0]);
|
||||
expect(configs[0].children[0].path).toBe(rConfigs[0].children ![0].path);
|
||||
expect(configs[0].children[1]).not.toBe(rConfigs[0].children ![1]);
|
||||
expect(configs[0].children[1].path).toBe(rConfigs[0].children ![1].path);
|
||||
expect(children).not.toBe(rChildren);
|
||||
expect(children[0]).not.toBe(rChildren[0]);
|
||||
expect(children[0].path).toBe(rChildren[0].path);
|
||||
expect(children[1]).not.toBe(rChildren[1]);
|
||||
expect(children[1].path).toBe(rChildren[1].path);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -125,41 +125,41 @@ describe('RouterState & Snapshot', () => {
|
|||
}
|
||||
|
||||
it('should return false when params are different', () => {
|
||||
expect(equalParamsAndUrlSegments(createSnapshot({a: 1}, []), createSnapshot({a: 2}, [])))
|
||||
expect(equalParamsAndUrlSegments(createSnapshot({a: '1'}, []), createSnapshot({a: '2'}, [])))
|
||||
.toEqual(false);
|
||||
});
|
||||
|
||||
it('should return false when urls are different', () => {
|
||||
expect(equalParamsAndUrlSegments(
|
||||
createSnapshot({a: 1}, [new UrlSegment('a', {})]),
|
||||
createSnapshot({a: 1}, [new UrlSegment('b', {})])))
|
||||
createSnapshot({a: '1'}, [new UrlSegment('a', {})]),
|
||||
createSnapshot({a: '1'}, [new UrlSegment('b', {})])))
|
||||
.toEqual(false);
|
||||
});
|
||||
|
||||
it('should return true othewise', () => {
|
||||
expect(equalParamsAndUrlSegments(
|
||||
createSnapshot({a: 1}, [new UrlSegment('a', {})]),
|
||||
createSnapshot({a: 1}, [new UrlSegment('a', {})])))
|
||||
createSnapshot({a: '1'}, [new UrlSegment('a', {})]),
|
||||
createSnapshot({a: '1'}, [new UrlSegment('a', {})])))
|
||||
.toEqual(true);
|
||||
});
|
||||
|
||||
it('should return false when upstream params are different', () => {
|
||||
const [snapshot1, snapshot2] =
|
||||
createSnapshotPairWithParent([{a: 1}, {a: 1}], [{b: 1}, {c: 1}], ['a', 'a']);
|
||||
createSnapshotPairWithParent([{a: '1'}, {a: '1'}], [{b: '1'}, {c: '1'}], ['a', 'a']);
|
||||
|
||||
expect(equalParamsAndUrlSegments(snapshot1, snapshot2)).toEqual(false);
|
||||
});
|
||||
|
||||
it('should return false when upstream urls are different', () => {
|
||||
const [snapshot1, snapshot2] =
|
||||
createSnapshotPairWithParent([{a: 1}, {a: 1}], [{b: 1}, {b: 1}], ['a', 'b']);
|
||||
createSnapshotPairWithParent([{a: '1'}, {a: '1'}], [{b: '1'}, {b: '1'}], ['a', 'b']);
|
||||
|
||||
expect(equalParamsAndUrlSegments(snapshot1, snapshot2)).toEqual(false);
|
||||
});
|
||||
|
||||
it('should return true when upstream urls and params are equal', () => {
|
||||
const [snapshot1, snapshot2] =
|
||||
createSnapshotPairWithParent([{a: 1}, {a: 1}], [{b: 1}, {b: 1}], ['a', 'a']);
|
||||
createSnapshotPairWithParent([{a: '1'}, {a: '1'}], [{b: '1'}, {b: '1'}], ['a', 'a']);
|
||||
|
||||
expect(equalParamsAndUrlSegments(snapshot1, snapshot2)).toEqual(true);
|
||||
});
|
||||
|
@ -184,8 +184,8 @@ describe('RouterState & Snapshot', () => {
|
|||
}
|
||||
|
||||
it('should call change observers', () => {
|
||||
const firstPlace = createSnapshot({a: 1}, []);
|
||||
const secondPlace = createSnapshot({a: 2}, []);
|
||||
const firstPlace = createSnapshot({a: '1'}, []);
|
||||
const secondPlace = createSnapshot({a: '2'}, []);
|
||||
route.snapshot = firstPlace;
|
||||
(route as any)._futureSnapshot = secondPlace;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ describe('SpyNgModuleFactoryLoader', () => {
|
|||
});
|
||||
|
||||
it('should return the created promise', () => {
|
||||
const expected = Promise.resolve('returned');
|
||||
const expected: any = Promise.resolve('returned');
|
||||
const compiler: any = {compileModuleAsync: () => expected};
|
||||
|
||||
const r = new SpyNgModuleFactoryLoader(<any>compiler);
|
||||
|
|
|
@ -387,35 +387,35 @@ import {async_fit, async_it} from './async';
|
|||
});
|
||||
it('processes update availability notifications when sent', (done: DoneFn) => {
|
||||
update.available.subscribe(event => {
|
||||
expect(event.current).toEqual({version: 'A'});
|
||||
expect(event.available).toEqual({version: 'B'});
|
||||
expect(event.current).toEqual({hash: 'A'});
|
||||
expect(event.available).toEqual({hash: 'B'});
|
||||
expect(event.type).toEqual('UPDATE_AVAILABLE');
|
||||
done();
|
||||
});
|
||||
mock.sendMessage({
|
||||
type: 'UPDATE_AVAILABLE',
|
||||
current: {
|
||||
version: 'A',
|
||||
hash: 'A',
|
||||
},
|
||||
available: {
|
||||
version: 'B',
|
||||
hash: 'B',
|
||||
},
|
||||
});
|
||||
});
|
||||
it('processes update activation notifications when sent', (done: DoneFn) => {
|
||||
update.activated.subscribe(event => {
|
||||
expect(event.previous).toEqual({version: 'A'});
|
||||
expect(event.current).toEqual({version: 'B'});
|
||||
expect(event.previous).toEqual({hash: 'A'});
|
||||
expect(event.current).toEqual({hash: 'B'});
|
||||
expect(event.type).toEqual('UPDATE_ACTIVATED');
|
||||
done();
|
||||
});
|
||||
mock.sendMessage({
|
||||
type: 'UPDATE_ACTIVATED',
|
||||
previous: {
|
||||
version: 'A',
|
||||
hash: 'A',
|
||||
},
|
||||
current: {
|
||||
version: 'B',
|
||||
hash: 'B',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
@ -30,10 +30,11 @@
|
|||
},
|
||||
"exclude": [
|
||||
"bazel",
|
||||
"compiler-cli/integrationtest",
|
||||
"platform-server/integrationtest",
|
||||
"common/locales",
|
||||
"elements/schematics"
|
||||
"compiler-cli/integrationtest",
|
||||
"elements/schematics",
|
||||
"examples/**/e2e_test/*",
|
||||
"platform-server/integrationtest"
|
||||
]
|
||||
|
||||
}
|
||||
|
|
|
@ -8,20 +8,19 @@
|
|||
|
||||
// This file contains all ambient imports needed to compile the modules/ source code
|
||||
|
||||
/// <reference path="../node_modules/zone.js/dist/zone.js.d.ts" />
|
||||
/// <reference path="../node_modules/@types/hammerjs/index.d.ts" />
|
||||
/// <reference path="../node_modules/@types/jasmine/index.d.ts" />
|
||||
/// <reference path="../node_modules/@types/node/index.d.ts" />
|
||||
/// <reference path="../node_modules/@types/selenium-webdriver/index.d.ts" />
|
||||
/// <reference path="../node_modules/zone.js/dist/zone.js.d.ts" />
|
||||
/// <reference path="./es6-subset.d.ts" />
|
||||
/// <reference path="./system.d.ts" />
|
||||
/// <reference path="./goog.d.ts" />
|
||||
/// <reference path="./system.d.ts" />
|
||||
|
||||
declare let isNode: boolean;
|
||||
declare let isBrowser: boolean;
|
||||
|
||||
declare namespace jasmine {
|
||||
interface Matchers {
|
||||
interface Matchers<T> {
|
||||
toHaveProperties(obj: any): boolean;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -787,7 +787,7 @@ withEachNg1Version(() => {
|
|||
childMod.componentFactoryResolver.resolveComponentFactory(LazyLoadedComponent) !;
|
||||
const lazyCmp = cmpFactory.create(componentInjector);
|
||||
|
||||
expect(lazyCmp.instance.module).toBe(childMod.injector);
|
||||
expect(lazyCmp.instance.module.injector).toBe(childMod.injector);
|
||||
});
|
||||
|
||||
}));
|
||||
|
|
|
@ -60,5 +60,6 @@ travisFoldEnd "tsc tools"
|
|||
travisFoldStart "tsc all"
|
||||
node dist/tools/@angular/compiler-cli/src/main -p packages/tsconfig-metadata.json
|
||||
$(npm bin)/tsc -p packages
|
||||
$(npm bin)/tsc -p packages/examples
|
||||
$(npm bin)/tsc -p modules
|
||||
travisFoldEnd "tsc all"
|
||||
|
|
|
@ -533,9 +533,7 @@ export declare abstract class UrlSerializer {
|
|||
export declare class UrlTree {
|
||||
fragment: string | null;
|
||||
readonly queryParamMap: ParamMap;
|
||||
queryParams: {
|
||||
[key: string]: string;
|
||||
};
|
||||
queryParams: Params;
|
||||
root: UrlSegmentGroup;
|
||||
toString(): string;
|
||||
}
|
||||
|
|
|
@ -40,10 +40,7 @@ const BaseConfig = {
|
|||
};
|
||||
|
||||
if (platform == 'node') {
|
||||
const specFiles = [
|
||||
'@angular/**/*_spec.js', '@angular/compiler-cli/test/**/*_spec.js',
|
||||
'@angular/benchpress/test/**/*_spec.js'
|
||||
];
|
||||
const specFiles = ['@angular/**/*_spec.js'];
|
||||
tscWatch = new TscWatch(Object.assign(
|
||||
{
|
||||
tsconfig: 'packages/tsconfig.json',
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Extended typings for `jasminewd2`.
|
||||
*
|
||||
* The currently used `jasminewd2` version (v2.1.0), supports passing a `done` callback to a spec,
|
||||
* but the latest typings on [DefinitelyTyped][1] do not reflect that.
|
||||
* Overwrite the relevant function signatures to add a `done` callback.
|
||||
*
|
||||
* [1]:
|
||||
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/566e0394859fdc1dc893658ccec6b06372d56a91/types/jasminewd2/index.d.ts#L9-L15
|
||||
*/
|
||||
declare function it(
|
||||
expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
|
||||
declare function fit(
|
||||
expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
|
||||
declare function xit(
|
||||
expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
|
||||
declare function beforeEach(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
|
||||
declare function afterEach(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
|
||||
declare function beforeAll(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
|
||||
declare function afterAll(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
|
42
yarn.lock
42
yarn.lock
|
@ -96,9 +96,15 @@
|
|||
version "2.0.35"
|
||||
resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.35.tgz#7b7c950c7d54593e23bffc8d2b4feba9866a7277"
|
||||
|
||||
"@types/jasmine@2.2.22-alpha":
|
||||
version "2.2.22-alpha"
|
||||
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.2.22-alpha.tgz#eecaee43fe42ef6b5cfefad1bcc370c433f485bf"
|
||||
"@types/jasmine@*", "@types/jasmine@^2.8.8":
|
||||
version "2.8.8"
|
||||
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.8.tgz#bf53a7d193ea8b03867a38bfdb4fbb0e0bf066c9"
|
||||
|
||||
"@types/jasminewd2@^2.0.3":
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/jasminewd2/-/jasminewd2-2.0.3.tgz#0d2886b0cbdae4c0eeba55e30792f584bf040a95"
|
||||
dependencies:
|
||||
"@types/jasmine" "*"
|
||||
|
||||
"@types/minimatch@*":
|
||||
version "3.0.3"
|
||||
|
@ -2517,13 +2523,6 @@ glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glo
|
|||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
glob@^3.2.11:
|
||||
version "3.2.11"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-3.2.11.tgz#4a973f635b9190f715d10987d5c00fd2815ebe3d"
|
||||
dependencies:
|
||||
inherits "2"
|
||||
minimatch "0.3"
|
||||
|
||||
glob@^4.3.1:
|
||||
version "4.5.3"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-4.5.3.tgz#c6cb73d3226c1efef04de3c56d012f03377ee15f"
|
||||
|
@ -3256,11 +3255,7 @@ isstream@~0.1.1, isstream@~0.1.2:
|
|||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
|
||||
|
||||
jasmine-core@2.4.1, jasmine-core@~2.4.0:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.4.1.tgz#6f83ab3a0f16951722ce07d206c773d57cc838be"
|
||||
|
||||
jasmine-core@~2.8.0:
|
||||
jasmine-core@2.8, jasmine-core@~2.8.0:
|
||||
version "2.8.0"
|
||||
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.8.0.tgz#bcc979ae1f9fd05701e45e52e65d3a5d63f1a24e"
|
||||
|
||||
|
@ -3270,15 +3265,7 @@ jasmine-diff@^0.1.3:
|
|||
dependencies:
|
||||
diff "^3.2.0"
|
||||
|
||||
jasmine@2.4.1:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.4.1.tgz#9016dda453213d27ac6d43dc4ea97315a189085e"
|
||||
dependencies:
|
||||
exit "^0.1.2"
|
||||
glob "^3.2.11"
|
||||
jasmine-core "~2.4.0"
|
||||
|
||||
jasmine@^2.5.3:
|
||||
jasmine@2.8, jasmine@^2.5.3:
|
||||
version "2.8.0"
|
||||
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.8.0.tgz#6b089c0a11576b1f16df11b80146d91d4e8b8a3e"
|
||||
dependencies:
|
||||
|
@ -3993,13 +3980,6 @@ mimic-fn@^1.0.0:
|
|||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"
|
||||
|
||||
minimatch@0.3:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.3.0.tgz#275d8edaac4f1bb3326472089e7949c8394699dd"
|
||||
dependencies:
|
||||
lru-cache "2"
|
||||
sigmund "~1.0.0"
|
||||
|
||||
"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
|
|
Loading…
Reference in New Issue