build(core): remove `main()` from specs (#21053)

`main()` function used to be needed to support dart, since dart
Does not allow top level statements. Since we no longer use dart
The need for `main()` has been removed.

In preparation for `Basel` and standardized way of running tests
we are removing `main()`

PR Close #21053
This commit is contained in:
Miško Hevery 2017-12-15 16:28:41 -08:00 committed by Igor Minar
parent 86a36eaadd
commit f3fc74ab67
59 changed files with 74 additions and 73 deletions

View File

@ -18,7 +18,7 @@ import {TestBed, fakeAsync, flushMicrotasks} from '../../testing';
const DEFAULT_NAMESPACE_ID = 'id'; const DEFAULT_NAMESPACE_ID = 'id';
const DEFAULT_COMPONENT_ID = '1'; const DEFAULT_COMPONENT_ID = '1';
export function main() { (function() {
// these tests are only mean't to be run within the DOM (for now) // these tests are only mean't to be run within the DOM (for now)
if (typeof Element == 'undefined') return; if (typeof Element == 'undefined') return;
@ -3428,7 +3428,7 @@ export function main() {
}); });
}); });
}); });
} });
function assertHasParent(element: any, yes: boolean) { function assertHasParent(element: any, yes: boolean) {
const parent = getDOM().parentElement(element); const parent = getDOM().parentElement(element);

View File

@ -19,7 +19,7 @@ import {TestBed} from '../../testing';
import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async';
export function main() { (function() {
// these tests are only mean't to be run within the DOM (for now) // these tests are only mean't to be run within the DOM (for now)
if (typeof Element == 'undefined') return; if (typeof Element == 'undefined') return;
@ -3300,7 +3300,7 @@ export function main() {
}); });
}); });
}); });
} })();
function cancelAllPlayers(players: AnimationPlayer[]) { function cancelAllPlayers(players: AnimationPlayer[]) {
players.forEach(p => p.destroy()); players.forEach(p => p.destroy());

View File

@ -14,7 +14,7 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {ActivatedRoute, Router, RouterOutlet} from '@angular/router'; import {ActivatedRoute, Router, RouterOutlet} from '@angular/router';
import {RouterTestingModule} from '@angular/router/testing'; import {RouterTestingModule} from '@angular/router/testing';
export function main() { (function() {
// these tests are only mean't to be run within the DOM (for now) // these tests are only mean't to be run within the DOM (for now)
if (typeof Element == 'undefined') return; if (typeof Element == 'undefined') return;
@ -519,7 +519,7 @@ export function main() {
expect(p2.element.getAttribute('data-depth')).toEqual('1'); expect(p2.element.getAttribute('data-depth')).toEqual('1');
})); }));
}); });
} });
function makeAnimationData(value: string, params: {[key: string]: any} = {}): {[key: string]: any} { function makeAnimationData(value: string, params: {[key: string]: any} = {}): {[key: string]: any} {
return {'animation': {value, params}}; return {'animation': {value, params}};

View File

@ -15,7 +15,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
import {TestBed} from '../../testing'; import {TestBed} from '../../testing';
export function main() { (function() {
// these tests are only mean't to be run within the DOM (for now) // these tests are only mean't to be run within the DOM (for now)
// Buggy in Chromium 39, see https://github.com/angular/angular/issues/15793 // Buggy in Chromium 39, see https://github.com/angular/angular/issues/15793
if (typeof Element == 'undefined' || !ɵsupportsWebAnimations()) return; if (typeof Element == 'undefined' || !ɵsupportsWebAnimations()) return;
@ -452,7 +452,7 @@ export function main() {
} }
}); });
}); });
} })();
function approximate(value: number, target: number) { function approximate(value: number, target: number) {
return Math.abs(target - value) / value; return Math.abs(target - value) / value;

View File

@ -9,7 +9,7 @@ import {Injector} from '@angular/core';
import {APP_INITIALIZER, ApplicationInitStatus} from '../src/application_init'; import {APP_INITIALIZER, ApplicationInitStatus} from '../src/application_init';
import {TestBed, async, inject} from '../testing'; import {TestBed, async, inject} from '../testing';
export function main() { {
describe('ApplicationInitStatus', () => { describe('ApplicationInitStatus', () => {
describe('no initializers', () => { describe('no initializers', () => {

View File

@ -9,7 +9,7 @@
import {LOCALE_ID} from '@angular/core'; import {LOCALE_ID} from '@angular/core';
import {describe, expect, inject, it} from '../testing/src/testing_internal'; import {describe, expect, inject, it} from '../testing/src/testing_internal';
export function main() { {
describe('Application module', () => { describe('Application module', () => {
it('should set the default locale to "en-US"', it('should set the default locale to "en-US"',
inject([LOCALE_ID], (defaultLocale: string) => { expect(defaultLocale).toEqual('en-US'); })); inject([LOCALE_ID], (defaultLocale: string) => { expect(defaultLocale).toEqual('en-US'); }));

View File

@ -15,7 +15,6 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens'; import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util'; import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
import {expect} from '@angular/platform-browser/testing/src/matchers'; import {expect} from '@angular/platform-browser/testing/src/matchers';
import {ServerModule} from '@angular/platform-server';
import {NoopNgZone} from '../src/zone/ng_zone'; import {NoopNgZone} from '../src/zone/ng_zone';
import {ComponentFixtureNoNgZone, TestBed, async, inject, withModule} from '../testing'; import {ComponentFixtureNoNgZone, TestBed, async, inject, withModule} from '../testing';
@ -23,7 +22,7 @@ import {ComponentFixtureNoNgZone, TestBed, async, inject, withModule} from '../t
class SomeComponent { class SomeComponent {
} }
export function main() { {
describe('bootstrap', () => { describe('bootstrap', () => {
let mockConsole: MockConsole; let mockConsole: MockConsole;
@ -54,7 +53,9 @@ export function main() {
const errorHandler = new ErrorHandler(); const errorHandler = new ErrorHandler();
(errorHandler as any)._console = mockConsole as any; (errorHandler as any)._console = mockConsole as any;
const platformModule = getDOM().supportsDOMEvents() ? BrowserModule : ServerModule; const platformModule = getDOM().supportsDOMEvents() ?
BrowserModule :
require('@angular/platform-server').ServerModule;
@NgModule({ @NgModule({
providers: [{provide: ErrorHandler, useValue: errorHandler}, options.providers || []], providers: [{provide: ErrorHandler, useValue: errorHandler}, options.providers || []],

View File

@ -8,7 +8,7 @@
import {devModeEqual} from '@angular/core/src/change_detection/change_detection_util'; import {devModeEqual} from '@angular/core/src/change_detection/change_detection_util';
export function main() { {
describe('ChangeDetectionUtil', () => { describe('ChangeDetectionUtil', () => {
describe('devModeEqual', () => { describe('devModeEqual', () => {
it('should do the deep comparison of iterables', () => { it('should do the deep comparison of iterables', () => {

View File

@ -24,7 +24,7 @@ class ComplexItem {
} }
// todo(vicb): UnmodifiableListView / frozen object when implemented // todo(vicb): UnmodifiableListView / frozen object when implemented
export function main() { {
describe('iterable differ', function() { describe('iterable differ', function() {
describe('DefaultIterableDiffer', function() { describe('DefaultIterableDiffer', function() {
let differ: DefaultIterableDiffer<any>; let differ: DefaultIterableDiffer<any>;

View File

@ -12,7 +12,7 @@ import {kvChangesAsString, testChangesAsString} from '../../change_detection/uti
// todo(vicb): Update the code & tests for object equality // todo(vicb): Update the code & tests for object equality
export function main() { {
describe('keyvalue differ', function() { describe('keyvalue differ', function() {
describe('DefaultKeyValueDiffer', function() { describe('DefaultKeyValueDiffer', function() {
let differ: DefaultKeyValueDiffer<any, any>; let differ: DefaultKeyValueDiffer<any, any>;

View File

@ -11,7 +11,7 @@ import {IterableDiffers} from '@angular/core/src/change_detection/differs/iterab
import {SpyIterableDifferFactory} from '../../spies'; import {SpyIterableDifferFactory} from '../../spies';
export function main() { {
describe('IterableDiffers', function() { describe('IterableDiffers', function() {
let factory1: any; let factory1: any;
let factory2: any; let factory2: any;

View File

@ -82,7 +82,7 @@ class NestedAsyncTimeoutComp {
} }
} }
export function main() { {
describe('ComponentFixture', () => { describe('ComponentFixture', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({

View File

@ -164,7 +164,7 @@ class TestApp {
isClosed = true; isClosed = true;
} }
export function main() { {
describe('debug element', () => { describe('debug element', () => {
let fixture: ComponentFixture<any>; let fixture: ComponentFixture<any>;

View File

@ -8,7 +8,7 @@
import {isDevMode} from '@angular/core'; import {isDevMode} from '@angular/core';
export function main() { {
describe('dev mode', () => { describe('dev mode', () => {
it('is enabled in our tests by default', () => { expect(isDevMode()).toBe(true); }); it('is enabled in our tests by default', () => { expect(isDevMode()).toBe(true); });
}); });

View File

@ -10,7 +10,7 @@ import {Type} from '@angular/core';
import {forwardRef, resolveForwardRef} from '@angular/core/src/di'; import {forwardRef, resolveForwardRef} from '@angular/core/src/di';
import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {describe, expect, it} from '@angular/core/testing/src/testing_internal';
export function main() { {
describe('forwardRef', function() { describe('forwardRef', function() {
it('should wrap and unwrap the reference', () => { it('should wrap and unwrap the reference', () => {
const ref = forwardRef(() => String); const ref = forwardRef(() => String);

View File

@ -10,7 +10,7 @@
import {Injector} from '@angular/core'; import {Injector} from '@angular/core';
import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {describe, expect, it} from '@angular/core/testing/src/testing_internal';
export function main() { {
describe('Injector.NULL', () => { describe('Injector.NULL', () => {
it('should throw if no arg is given', () => { it('should throw if no arg is given', () => {
expect(() => Injector.NULL.get('someToken')) expect(() => Injector.NULL.get('someToken'))

View File

@ -66,9 +66,9 @@ class NoAnnotations {
constructor(secretDependency: any) {} constructor(secretDependency: any) {}
} }
function factoryFn(a: any) {} function factoryFn(a: any){}
export function main() { (function() {
const dynamicProviders = [ const dynamicProviders = [
{provide: 'provider0', useValue: 1}, {provide: 'provider1', useValue: 1}, {provide: 'provider0', useValue: 1}, {provide: 'provider1', useValue: 1},
{provide: 'provider2', useValue: 1}, {provide: 'provider3', useValue: 1}, {provide: 'provider2', useValue: 1}, {provide: 'provider3', useValue: 1},
@ -526,4 +526,4 @@ export function main() {
.toEqual('ReflectiveInjector(providers: [ "Engine" , "BrokenEngine" ])'); .toEqual('ReflectiveInjector(providers: [ "Engine" , "BrokenEngine" ])');
}); });
}); });
} })();

View File

@ -8,7 +8,7 @@
import {KeyRegistry} from '@angular/core/src/di/reflective_key'; import {KeyRegistry} from '@angular/core/src/di/reflective_key';
export function main() { {
describe('key', function() { describe('key', function() {
let registry: KeyRegistry; let registry: KeyRegistry;

View File

@ -75,9 +75,9 @@ class NoAnnotations {
constructor(secretDependency: any) {} constructor(secretDependency: any) {}
} }
function factoryFn(a: any) {} function factoryFn(a: any){}
export function main() { {
const dynamicProviders = [ const dynamicProviders = [
{provide: 'provider0', useValue: 1}, {provide: 'provider1', useValue: 1}, {provide: 'provider0', useValue: 1}, {provide: 'provider1', useValue: 1},
{provide: 'provider2', useValue: 1}, {provide: 'provider3', useValue: 1}, {provide: 'provider2', useValue: 1}, {provide: 'provider3', useValue: 1},

View File

@ -11,7 +11,7 @@ import {Component, Directive} from '@angular/core/src/metadata';
import {TestBed, inject} from '@angular/core/testing'; import {TestBed, inject} from '@angular/core/testing';
import {Log} from '@angular/core/testing/src/testing_internal'; import {Log} from '@angular/core/testing/src/testing_internal';
export function main() { {
describe('directive lifecycle integration spec', () => { describe('directive lifecycle integration spec', () => {
let log: Log; let log: Log;

View File

@ -10,7 +10,7 @@ import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testin
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {el, stringifyElement} from '@angular/platform-browser/testing/src/browser_util'; import {el, stringifyElement} from '@angular/platform-browser/testing/src/browser_util';
export function main() { {
describe('dom adapter', () => { describe('dom adapter', () => {
let defaultDoc: any; let defaultDoc: any;
beforeEach(() => { beforeEach(() => {

View File

@ -8,7 +8,7 @@
import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {describe, expect, it} from '@angular/core/testing/src/testing_internal';
export function main() { {
describe('Shim', () => { describe('Shim', () => {
it('should provide correct function.name ', () => { it('should provide correct function.name ', () => {

View File

@ -15,7 +15,7 @@ class MockConsole {
error(...s: any[]): void { this.res.push(s); } error(...s: any[]): void { this.res.push(s); }
} }
export function main() { (function() {
function errorToString(error: any) { function errorToString(error: any) {
const logger = new MockConsole(); const logger = new MockConsole();
const errorHandler = new ErrorHandler(); const errorHandler = new ErrorHandler();
@ -72,7 +72,7 @@ ERROR CONTEXT#Context`);
expect(logger).toHaveBeenCalledWith(console, 'ERROR', err); expect(logger).toHaveBeenCalledWith(console, 'ERROR', err);
}); });
}); });
} })();
function debugError(originalError: any, context: any): Error { function debugError(originalError: any, context: any): Error {
const error = wrappedError(`Error in ${context.source}`, originalError); const error = wrappedError(`Error in ${context.source}`, originalError);

View File

@ -9,7 +9,7 @@
import {AsyncTestCompleter, beforeEach, describe, expect, inject, it} from '@angular/core/testing/src/testing_internal'; import {AsyncTestCompleter, beforeEach, describe, expect, inject, it} from '@angular/core/testing/src/testing_internal';
import {EventEmitter} from '../src/event_emitter'; import {EventEmitter} from '../src/event_emitter';
export function main() { {
describe('EventEmitter', () => { describe('EventEmitter', () => {
let emitter: EventEmitter<any>; let emitter: EventEmitter<any>;

View File

@ -12,10 +12,11 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
import {Parser} from '../../compiler/src/expression_parser/parser'; import {Parser} from '../../compiler/src/expression_parser/parser';
const resolvedPromise = Promise.resolve(null); const resolvedPromise = Promise.resolve(null);
const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec']; const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'];
export function main() { {
describe('fake async', () => { describe('fake async', () => {
it('should run synchronous code', () => { it('should run synchronous code', () => {
let ran = false; let ran = false;

View File

@ -11,7 +11,7 @@ import {Component, ContentChildren, Directive, Inject, NO_ERRORS_SCHEMA, NgModul
import {TestBed} from '@angular/core/testing'; import {TestBed} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/src/matchers'; import {expect} from '@angular/platform-browser/testing/src/matchers';
export function main() { {
describe('forwardRef integration', function() { describe('forwardRef integration', function() {
beforeEach(() => { TestBed.configureTestingModule({imports: [Module], declarations: [App]}); }); beforeEach(() => { TestBed.configureTestingModule({imports: [Module], declarations: [App]}); });

View File

@ -25,7 +25,7 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
]; ];
export function main() { (function() {
let elSchema: MockSchemaRegistry; let elSchema: MockSchemaRegistry;
let renderLog: RenderLog; let renderLog: RenderLog;
let directiveLog: DirectiveLog; let directiveLog: DirectiveLog;
@ -1608,7 +1608,7 @@ export function main() {
}); });
}); });
}); });
} })();
@Injectable() @Injectable()
class RenderLog { class RenderLog {

View File

@ -13,7 +13,7 @@ import {TestBed} from '@angular/core/testing';
import {Console} from '../../src/console'; import {Console} from '../../src/console';
export function main() { {
describe('jit', () => { declareTests({useJit: true}); }); describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); }); describe('no jit', () => { declareTests({useJit: false}); });
} }

View File

@ -28,7 +28,7 @@ import {stringify} from '../../src/util';
const ANCHOR_ELEMENT = new InjectionToken('AnchorElement'); const ANCHOR_ELEMENT = new InjectionToken('AnchorElement');
export function main() { {
describe('jit', () => { declareTests({useJit: true}); }); describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); }); describe('no jit', () => { declareTests({useJit: false}); });

View File

@ -13,7 +13,7 @@ import {Component, Directive, Injectable, NgModule, Pipe, Type} from '@angular/c
import {TestBed, async, getTestBed} from '@angular/core/testing'; import {TestBed, async, getTestBed} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/src/matchers'; import {expect} from '@angular/platform-browser/testing/src/matchers';
export function main() { {
describe('Jit Summaries', () => { describe('Jit Summaries', () => {
let instances: Map<any, Base>; let instances: Map<any, Base>;
let summaries: () => any[]; let summaries: () => any[];

View File

@ -12,7 +12,7 @@ import {TestBed} from '@angular/core/testing';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {expect} from '@angular/platform-browser/testing/src/matchers'; import {expect} from '@angular/platform-browser/testing/src/matchers';
export function main() { {
describe('jit', () => { declareTests({useJit: true}); }); describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); }); describe('no jit', () => { declareTests({useJit: false}); });
} }

View File

@ -102,7 +102,7 @@ class DummyConsole implements Console {
warn(message: string) { this.warnings.push(message); } warn(message: string) { this.warnings.push(message); }
} }
export function main() { {
describe('jit', () => { declareTests({useJit: true}); }); describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); }); describe('no jit', () => { declareTests({useJit: false}); });

View File

@ -12,7 +12,7 @@ import {By} from '@angular/platform-browser/src/dom/debug/by';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {expect} from '@angular/platform-browser/testing/src/matchers'; import {expect} from '@angular/platform-browser/testing/src/matchers';
export function main() { {
describe('projection', () => { describe('projection', () => {
beforeEach(() => TestBed.configureTestingModule({declarations: [MainComp, OtherComp, Simple]})); beforeEach(() => TestBed.configureTestingModule({declarations: [MainComp, OtherComp, Simple]}));

View File

@ -14,7 +14,7 @@ import {Subject} from 'rxjs/Subject';
import {stringify} from '../../src/util'; import {stringify} from '../../src/util';
export function main() { {
describe('Query API', () => { describe('Query API', () => {
beforeEach(() => TestBed.configureTestingModule({ beforeEach(() => TestBed.configureTestingModule({

View File

@ -12,7 +12,7 @@ import {fakeAsync, tick} from '@angular/core/testing';
import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
export function main() { {
describe('QueryList', () => { describe('QueryList', () => {
let queryList: QueryList<string>; let queryList: QueryList<string>;
let log: string; let log: string;

View File

@ -13,7 +13,7 @@ import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {expect} from '@angular/platform-browser/testing/src/matchers'; import {expect} from '@angular/platform-browser/testing/src/matchers';
export function main() { {
describe('jit', () => { declareTests({useJit: true}); }); describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); }); describe('no jit', () => { declareTests({useJit: false}); });

View File

@ -11,7 +11,7 @@ import {ComponentFixture, TestBed, getTestBed} from '@angular/core/testing';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {DomSanitizer} from '@angular/platform-browser/src/security/dom_sanitization_service'; import {DomSanitizer} from '@angular/platform-browser/src/security/dom_sanitization_service';
export function main() { {
describe('jit', () => { declareTests({useJit: true}); }); describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); }); describe('no jit', () => { declareTests({useJit: false}); });

View File

@ -8,13 +8,13 @@
import {ResourceLoader} from '@angular/compiler'; import {ResourceLoader} from '@angular/compiler';
import {SourceMap} from '@angular/compiler/src/output/source_map'; import {SourceMap} from '@angular/compiler/src/output/source_map';
import {extractSourceMap, originalPositionFor} from '@angular/compiler/test/output/source_map_util'; import {extractSourceMap, originalPositionFor} from '@angular/compiler/testing/src/output/source_map_util';
import {MockResourceLoader} from '@angular/compiler/testing/src/resource_loader_mock'; import {MockResourceLoader} from '@angular/compiler/testing/src/resource_loader_mock';
import {Attribute, Component, Directive, ErrorHandler, ɵglobal} from '@angular/core'; import {Attribute, Component, Directive, ErrorHandler, ɵglobal} from '@angular/core';
import {getErrorLogger} from '@angular/core/src/errors'; import {getErrorLogger} from '@angular/core/src/errors';
import {ComponentFixture, TestBed, fakeAsync, tick} from '@angular/core/testing'; import {ComponentFixture, TestBed, fakeAsync, tick} from '@angular/core/testing';
export function main() { {
describe('jit source mapping', () => { describe('jit source mapping', () => {
let jitSpy: jasmine.Spy; let jitSpy: jasmine.Spy;
let resourceLoader: MockResourceLoader; let resourceLoader: MockResourceLoader;

View File

@ -20,7 +20,7 @@ function mockSystem(modules: {[module: string]: any}) {
}; };
} }
export function main() { {
describe('SystemJsNgModuleLoader', () => { describe('SystemJsNgModuleLoader', () => {
let oldSystem: any = null; let oldSystem: any = null;
beforeEach(() => { beforeEach(() => {

View File

@ -182,7 +182,7 @@ export class DuplicatePipe2 implements PipeTransform {
class TestComp { class TestComp {
} }
export function main() { (function() {
function createComponentFixture<T>( function createComponentFixture<T>(
template: string, providers?: Provider[] | null, comp?: Type<T>): ComponentFixture<T> { template: string, providers?: Provider[] | null, comp?: Type<T>): ComponentFixture<T> {
if (!comp) { if (!comp) {
@ -932,7 +932,7 @@ export function main() {
}); });
}); });
}); });
} })();
class TestValue { class TestValue {
constructor(public value: string) {} constructor(public value: string) {}

View File

@ -9,7 +9,7 @@
import {Component, Directive, ElementRef, Input, NO_ERRORS_SCHEMA, QueryList, ViewChild, ViewChildren} from '@angular/core'; import {Component, Directive, ElementRef, Input, NO_ERRORS_SCHEMA, QueryList, ViewChild, ViewChildren} from '@angular/core';
import {TestBed} from '@angular/core/testing'; import {TestBed} from '@angular/core/testing';
export function main() { {
describe('ViewChild', () => { describe('ViewChild', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({

View File

@ -67,7 +67,7 @@ class TestObj {
identity(arg: any) { return arg; } identity(arg: any) { return arg; }
} }
export function main() { {
describe('Reflector', () => { describe('Reflector', () => {
let reflector: Reflector; let reflector: Reflector;

View File

@ -44,7 +44,7 @@ class MockNgZone extends NgZone {
stable(): void { this.onStable.emit(null); } stable(): void { this.onStable.emit(null); }
} }
export function main() { {
describe('Testability', () => { describe('Testability', () => {
let testability: Testability; let testability: Testability;
let execute: any; let execute: any;

View File

@ -19,7 +19,7 @@ class SpyTestObj extends SpyObject {
constructor() { super(TestObj); } constructor() { super(TestObj); }
} }
export function main() { {
describe('testing', () => { describe('testing', () => {
describe('equality', () => { describe('equality', () => {
it('should structurally compare objects', () => { it('should structurally compare objects', () => {

View File

@ -12,7 +12,7 @@ import {ANNOTATIONS, makeDecorator, makePropDecorator} from '../../src/util/deco
class DecoratedParent {} class DecoratedParent {}
class DecoratedChild extends DecoratedParent {} class DecoratedChild extends DecoratedParent {}
export function main() { {
const TerminalDecorator = const TerminalDecorator =
makeDecorator('TerminalDecorator', (data: any) => ({terminal: true, ...data})); makeDecorator('TerminalDecorator', (data: any) => ({terminal: true, ...data}));
const TestDecorator = makeDecorator( const TestDecorator = makeDecorator(

View File

@ -8,7 +8,7 @@
import {isObservable, isPromise} from '@angular/core/src/util/lang'; import {isObservable, isPromise} from '@angular/core/src/util/lang';
import {of } from 'rxjs/observable/of'; import {of } from 'rxjs/observable/of';
export function main() { {
describe('isPromise', () => { describe('isPromise', () => {
it('should be true for native Promises', it('should be true for native Promises',
() => expect(isPromise(Promise.resolve(true))).toEqual(true)); () => expect(isPromise(Promise.resolve(true))).toEqual(true));

View File

@ -8,7 +8,7 @@
import {stringify} from '../src/util'; import {stringify} from '../src/util';
export function main() { {
describe('stringify', () => { describe('stringify', () => {
it('should return string undefined when toString returns undefined', it('should return string undefined when toString returns undefined',
() => expect(stringify({toString: (): any => undefined})).toBe('undefined')); () => expect(stringify({toString: (): any => undefined})).toBe('undefined'));

View File

@ -12,7 +12,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {compViewDef, createAndGetRootNodes} from './helper'; import {compViewDef, createAndGetRootNodes} from './helper';
export function main() { {
describe(`View Anchor`, () => { describe(`View Anchor`, () => {
describe('create', () => { describe('create', () => {

View File

@ -20,7 +20,7 @@ import {callMostRecentEventListenerHandler, compViewDef, createAndGetRootNodes,
*/ */
const addEventListener = '__zone_symbol__addEventListener'; const addEventListener = '__zone_symbol__addEventListener';
export function main() { {
describe(`Component Views`, () => { describe(`Component Views`, () => {
it('should create and attach component views', () => { it('should create and attach component views', () => {
let instance: AComp = undefined !; let instance: AComp = undefined !;

View File

@ -23,7 +23,7 @@ import {ARG_TYPE_VALUES, callMostRecentEventListenerHandler, checkNodeInlineOrDy
const addEventListener = '__zone_symbol__addEventListener'; const addEventListener = '__zone_symbol__addEventListener';
const removeEventListener = '__zone_symbol__removeEventListener'; const removeEventListener = '__zone_symbol__removeEventListener';
export function main() { {
describe(`View Elements`, () => { describe(`View Elements`, () => {
describe('create', () => { describe('create', () => {

View File

@ -12,7 +12,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedView} from './helper'; import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedView} from './helper';
export function main() { {
describe(`Embedded Views`, () => { describe(`Embedded Views`, () => {
it('should create embedded views with the right context', () => { it('should create embedded views with the right context', () => {

View File

@ -12,7 +12,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {compViewDef, compViewDefFactory, createEmbeddedView, createRootView, isBrowser} from './helper'; import {compViewDef, compViewDefFactory, createEmbeddedView, createRootView, isBrowser} from './helper';
export function main() { {
describe(`View NgContent`, () => { describe(`View NgContent`, () => {
function hostElDef( function hostElDef(
checkIndex: number, contentNodes: NodeDef[], viewNodes: NodeDef[]): NodeDef[] { checkIndex: number, contentNodes: NodeDef[], viewNodes: NodeDef[]): NodeDef[] {

View File

@ -14,7 +14,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, createRootView, createAndGetRootNodes, compViewDef, compViewDefFactory} from './helper'; import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, createRootView, createAndGetRootNodes, compViewDef, compViewDefFactory} from './helper';
export function main() { {
describe(`View Providers`, () => { describe(`View Providers`, () => {
describe('create', () => { describe('create', () => {

View File

@ -11,7 +11,7 @@ import {NodeFlags, Services, asProviderData, directiveDef, elementDef, nodeValue
import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, compViewDef, createAndGetRootNodes} from './helper'; import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, compViewDef, createAndGetRootNodes} from './helper';
export function main() { {
describe(`View Pure Expressions`, () => { describe(`View Pure Expressions`, () => {
class Service { class Service {

View File

@ -12,7 +12,7 @@ import {NodeDef, NodeFlags, QueryBindingType, QueryValueType, Services, anchorDe
import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedView} from './helper'; import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedView} from './helper';
export function main() { {
describe(`Query Views`, () => { describe(`Query Views`, () => {
const someQueryId = 1; const someQueryId = 1;

View File

@ -10,7 +10,7 @@ import {DebugContext, NodeFlags, QueryValueType, Services, asElementData, asText
import {compViewDef, createAndGetRootNodes} from './helper'; import {compViewDef, createAndGetRootNodes} from './helper';
export function main() { {
describe('View Services', () => { describe('View Services', () => {
describe('DebugContext', () => { describe('DebugContext', () => {

View File

@ -12,7 +12,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, compViewDef, createAndGetRootNodes} from './helper'; import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, compViewDef, createAndGetRootNodes} from './helper';
export function main() { {
describe(`View Text`, () => { describe(`View Text`, () => {
describe('create', () => { describe('create', () => {

View File

@ -9,7 +9,7 @@
import {NodeFlags, QueryValueType, ViewDefinition, ViewFlags, anchorDef, directiveDef, elementDef, textDef, viewDef} from '@angular/core/src/view/index'; import {NodeFlags, QueryValueType, ViewDefinition, ViewFlags, anchorDef, directiveDef, elementDef, textDef, viewDef} from '@angular/core/src/view/index';
import {filterQueryId} from '@angular/core/src/view/util'; import {filterQueryId} from '@angular/core/src/view/util';
export function main() { {
describe('viewDef', () => { describe('viewDef', () => {
describe('parent', () => { describe('parent', () => {

View File

@ -62,9 +62,8 @@ function runNgZoneNoLog(fn: () => any) {
} }
} }
export function main() { {
describe('NgZone', () => { describe('NgZone', () => {
function createZone(enableLongStackTrace: boolean) { function createZone(enableLongStackTrace: boolean) {
return new NgZone({enableLongStackTrace: enableLongStackTrace}); return new NgZone({enableLongStackTrace: enableLongStackTrace});
} }