fix(test_lib): add missing types
This commit is contained in:
parent
f6108c54ec
commit
34deda594f
|
@ -28,3 +28,4 @@ export {ComponentRef} from 'angular2/src/core/compiler/dynamic_component_loader'
|
||||||
|
|
||||||
export {NgZone} from 'angular2/src/core/zone/ng_zone';
|
export {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||||
export {Observable, EventEmitter} from 'angular2/src/core/facade/async';
|
export {Observable, EventEmitter} from 'angular2/src/core/facade/async';
|
||||||
|
export {Predicate} from 'angular2/src/core/facade/collection';
|
||||||
|
|
|
@ -137,6 +137,12 @@ export class DebugElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a DebugElement for a ElementRef.
|
||||||
|
*
|
||||||
|
* @param {ElementRef}: elementRef
|
||||||
|
* @return {DebugElement}
|
||||||
|
*/
|
||||||
export function inspectElement(elementRef: ElementRef): DebugElement {
|
export function inspectElement(elementRef: ElementRef): DebugElement {
|
||||||
return DebugElement.create(elementRef);
|
return DebugElement.create(elementRef);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ export class DebugElementViewListener implements AppViewListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ELEMENT_PROBE_BINDINGS = CONST_EXPR([
|
export const ELEMENT_PROBE_BINDINGS: any[] = CONST_EXPR([
|
||||||
DebugElementViewListener,
|
DebugElementViewListener,
|
||||||
CONST_EXPR(new Binding(AppViewListener, {toAlias: DebugElementViewListener})),
|
CONST_EXPR(new Binding(AppViewListener, {toAlias: DebugElementViewListener})),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -65,7 +65,7 @@ export function fakeAsync(fn: Function): Function {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO we should fix tick to dequeue the failed timer instead of relying on clearPendingTimers
|
// TODO we should fix tick to dequeue the failed timer instead of relying on clearPendingTimers
|
||||||
export function clearPendingTimers() {
|
export function clearPendingTimers(): void {
|
||||||
ListWrapper.clear(_microtasks);
|
ListWrapper.clear(_microtasks);
|
||||||
ListWrapper.clear(_pendingPeriodicTimers);
|
ListWrapper.clear(_pendingPeriodicTimers);
|
||||||
ListWrapper.clear(_pendingTimers);
|
ListWrapper.clear(_pendingTimers);
|
||||||
|
|
|
@ -16,9 +16,9 @@ export var proxy: ClassDecorator = (t) => t;
|
||||||
|
|
||||||
var _global: jasmine.GlobalPolluter = <any>(typeof window === 'undefined' ? global : window);
|
var _global: jasmine.GlobalPolluter = <any>(typeof window === 'undefined' ? global : window);
|
||||||
|
|
||||||
export var afterEach = _global.afterEach;
|
export var afterEach: Function = _global.afterEach;
|
||||||
|
|
||||||
type SyncTestFn = () => void;
|
export type SyncTestFn = () => void;
|
||||||
type AsyncTestFn = (done: () => void) => void;
|
type AsyncTestFn = (done: () => void) => void;
|
||||||
type AnyTestFn = SyncTestFn | AsyncTestFn;
|
type AnyTestFn = SyncTestFn | AsyncTestFn;
|
||||||
|
|
||||||
|
@ -88,19 +88,19 @@ function _describe(jsmFn, ...args) {
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function describe(...args) {
|
export function describe(...args): void {
|
||||||
return _describe(jsmDescribe, ...args);
|
return _describe(jsmDescribe, ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ddescribe(...args) {
|
export function ddescribe(...args): void {
|
||||||
return _describe(jsmDDescribe, ...args);
|
return _describe(jsmDDescribe, ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function xdescribe(...args) {
|
export function xdescribe(...args): void {
|
||||||
return _describe(jsmXDescribe, ...args);
|
return _describe(jsmXDescribe, ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function beforeEach(fn: FunctionWithParamTokens | SyncTestFn) {
|
export function beforeEach(fn: FunctionWithParamTokens | SyncTestFn): void {
|
||||||
if (runnerStack.length > 0) {
|
if (runnerStack.length > 0) {
|
||||||
// Inside a describe block, beforeEach() uses a BeforeEachRunner
|
// Inside a describe block, beforeEach() uses a BeforeEachRunner
|
||||||
runnerStack[runnerStack.length - 1].beforeEach(fn);
|
runnerStack[runnerStack.length - 1].beforeEach(fn);
|
||||||
|
@ -122,7 +122,7 @@ export function beforeEach(fn: FunctionWithParamTokens | SyncTestFn) {
|
||||||
* bind(SomeToken).toValue(myValue),
|
* bind(SomeToken).toValue(myValue),
|
||||||
* ]);
|
* ]);
|
||||||
*/
|
*/
|
||||||
export function beforeEachBindings(fn) {
|
export function beforeEachBindings(fn): void {
|
||||||
jsmBeforeEach(() => {
|
jsmBeforeEach(() => {
|
||||||
var bindings = fn();
|
var bindings = fn();
|
||||||
if (!bindings) return;
|
if (!bindings) return;
|
||||||
|
@ -131,7 +131,7 @@ export function beforeEachBindings(fn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _it(jsmFn: Function, name: string, testFn: FunctionWithParamTokens | AnyTestFn,
|
function _it(jsmFn: Function, name: string, testFn: FunctionWithParamTokens | AnyTestFn,
|
||||||
timeOut: number) {
|
timeOut: number): void {
|
||||||
var runner = runnerStack[runnerStack.length - 1];
|
var runner = runnerStack[runnerStack.length - 1];
|
||||||
|
|
||||||
if (testFn instanceof FunctionWithParamTokens) {
|
if (testFn instanceof FunctionWithParamTokens) {
|
||||||
|
@ -183,15 +183,15 @@ function _it(jsmFn: Function, name: string, testFn: FunctionWithParamTokens | An
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function it(name, fn, timeOut = null) {
|
export function it(name, fn, timeOut = null): void {
|
||||||
return _it(jsmIt, name, fn, timeOut);
|
return _it(jsmIt, name, fn, timeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function xit(name, fn, timeOut = null) {
|
export function xit(name, fn, timeOut = null): void {
|
||||||
return _it(jsmXIt, name, fn, timeOut);
|
return _it(jsmXIt, name, fn, timeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function iit(name, fn, timeOut = null) {
|
export function iit(name, fn, timeOut = null): void {
|
||||||
return _it(jsmIIt, name, fn, timeOut);
|
return _it(jsmIIt, name, fn, timeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,9 @@ export class BrowserDetection {
|
||||||
return this._ua.indexOf('Chrome/4') > -1 && this._ua.indexOf('Edge') == -1;
|
return this._ua.indexOf('Chrome/4') > -1 && this._ua.indexOf('Edge') == -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export var browserDetection = new BrowserDetection(null);
|
export var browserDetection: BrowserDetection = new BrowserDetection(null);
|
||||||
|
|
||||||
export function dispatchEvent(element, eventType) {
|
export function dispatchEvent(element, eventType): void {
|
||||||
DOM.dispatchEvent(element, DOM.createEvent(eventType));
|
DOM.dispatchEvent(element, DOM.createEvent(eventType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue