Skip to content

Commit

Permalink
fix(test_lib): add missing types
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Sep 3, 2015
1 parent f6108c5 commit 34deda5
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
1 change: 1 addition & 0 deletions modules/angular2/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ export {ComponentRef} from 'angular2/src/core/compiler/dynamic_component_loader'

export {NgZone} from 'angular2/src/core/zone/ng_zone';
export {Observable, EventEmitter} from 'angular2/src/core/facade/async';
export {Predicate} from 'angular2/src/core/facade/collection';
6 changes: 6 additions & 0 deletions modules/angular2/src/core/debug/debug_element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ export class DebugElement {
}
}

/**
* Returns a DebugElement for a ElementRef.
*
* @param {ElementRef}: elementRef
* @return {DebugElement}
*/
export function inspectElement(elementRef: ElementRef): DebugElement {
return DebugElement.create(elementRef);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
CONST_EXPR(new Binding(AppViewListener, {toAlias: DebugElementViewListener})),
]);
2 changes: 1 addition & 1 deletion modules/angular2/src/test_lib/fake_async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
export function clearPendingTimers() {
export function clearPendingTimers(): void {
ListWrapper.clear(_microtasks);
ListWrapper.clear(_pendingPeriodicTimers);
ListWrapper.clear(_pendingTimers);
Expand Down
22 changes: 11 additions & 11 deletions modules/angular2/src/test_lib/test_lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export var proxy: ClassDecorator = (t) => t;

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 AnyTestFn = SyncTestFn | AsyncTestFn;

Expand Down Expand Up @@ -88,19 +88,19 @@ function _describe(jsmFn, ...args) {
return suite;
}

export function describe(...args) {
export function describe(...args): void {
return _describe(jsmDescribe, ...args);
}

export function ddescribe(...args) {
export function ddescribe(...args): void {
return _describe(jsmDDescribe, ...args);
}

export function xdescribe(...args) {
export function xdescribe(...args): void {
return _describe(jsmXDescribe, ...args);
}

export function beforeEach(fn: FunctionWithParamTokens | SyncTestFn) {
export function beforeEach(fn: FunctionWithParamTokens | SyncTestFn): void {
if (runnerStack.length > 0) {
// Inside a describe block, beforeEach() uses a BeforeEachRunner
runnerStack[runnerStack.length - 1].beforeEach(fn);
Expand All @@ -122,7 +122,7 @@ export function beforeEach(fn: FunctionWithParamTokens | SyncTestFn) {
* bind(SomeToken).toValue(myValue),
* ]);
*/
export function beforeEachBindings(fn) {
export function beforeEachBindings(fn): void {
jsmBeforeEach(() => {
var bindings = fn();
if (!bindings) return;
Expand All @@ -131,7 +131,7 @@ export function beforeEachBindings(fn) {
}

function _it(jsmFn: Function, name: string, testFn: FunctionWithParamTokens | AnyTestFn,
timeOut: number) {
timeOut: number): void {
var runner = runnerStack[runnerStack.length - 1];

if (testFn instanceof FunctionWithParamTokens) {
Expand Down Expand Up @@ -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);
}

export function xit(name, fn, timeOut = null) {
export function xit(name, fn, timeOut = null): void {
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);
}

Expand Down
4 changes: 2 additions & 2 deletions modules/angular2/src/test_lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export class BrowserDetection {
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));
}

Expand Down

0 comments on commit 34deda5

Please sign in to comment.