chore: add more types to a number of top-level properties and methods
This commit is contained in:
parent
c8ebd11d63
commit
75db2c5241
|
@ -20,7 +20,7 @@ import {Location} from './src/router/location';
|
|||
import {appComponentAnnotatedTypeToken} from './src/core/application_tokens';
|
||||
import {bind} from './di';
|
||||
|
||||
export var routerInjectables = [
|
||||
export var routerInjectables:List = [
|
||||
RouteRegistry,
|
||||
Pipeline,
|
||||
Location,
|
||||
|
|
|
@ -93,4 +93,4 @@ export class JitChangeDetection extends ChangeDetection {
|
|||
}
|
||||
}
|
||||
|
||||
export var defaultPipeRegistry = new PipeRegistry(defaultPipes);
|
||||
export var defaultPipeRegistry:PipeRegistry = new PipeRegistry(defaultPipes);
|
||||
|
|
|
@ -134,7 +134,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
|||
}
|
||||
MouseEvent createMouseEvent(String eventType) =>
|
||||
new MouseEvent(eventType, canBubble: true);
|
||||
Event createEvent(eventType) => new Event(eventType, canBubble: true);
|
||||
Event createEvent(String eventType) => new Event(eventType, canBubble: true);
|
||||
String getInnerHTML(Element el) => el.innerHtml;
|
||||
String getOuterHTML(Element el) => el.outerHtml;
|
||||
void setInnerHTML(Element el, String value) {
|
||||
|
|
|
@ -52,7 +52,7 @@ export class DomAdapter {
|
|||
createMouseEvent(eventType) {
|
||||
throw _abstract();
|
||||
}
|
||||
createEvent(eventType) {
|
||||
createEvent(eventType:string) {
|
||||
throw _abstract();
|
||||
}
|
||||
getInnerHTML(el) {
|
||||
|
|
|
@ -146,7 +146,7 @@ class Html5LibDomAdapter implements DomAdapter {
|
|||
setChecked(el, bool value) {
|
||||
throw 'not implemented';
|
||||
}
|
||||
createTemplate(html) => createElement('template')..innerHtml = html;
|
||||
createTemplate(String html) => createElement('template')..innerHtml = html;
|
||||
createElement(tagName, [doc]) {
|
||||
return new Element.tag(tagName);
|
||||
}
|
||||
|
|
|
@ -272,6 +272,6 @@ export class ControlGroupDirective {
|
|||
* @exportedAs angular2/forms
|
||||
*/
|
||||
// todo(misko): rename to lover case as it is not a Type but a var.
|
||||
export var FormDirectives = [
|
||||
export var FormDirectives:List = [
|
||||
ControlGroupDirective, ControlDirective, CheckboxControlValueAccessor, DefaultValueAccessor
|
||||
];
|
||||
|
|
|
@ -118,7 +118,7 @@ function _getAppBindings() {
|
|||
];
|
||||
}
|
||||
|
||||
export function createTestInjector(bindings: List) {
|
||||
export function createTestInjector(bindings: List):Injector {
|
||||
var rootInjector = Injector.resolveAndCreate(_getRootBindings());
|
||||
return rootInjector.resolveAndCreateChild(ListWrapper.concat(_getAppBindings(), bindings));
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ export function createTestInjector(bindings: List) {
|
|||
* @return {FunctionWithParamTokens}
|
||||
* @exportedAs angular2/test
|
||||
*/
|
||||
export function inject(tokens: List, fn: Function) {
|
||||
export function inject(tokens: List, fn: Function):FunctionWithParamTokens {
|
||||
return new FunctionWithParamTokens(tokens, fn);
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ export class FunctionWithParamTokens {
|
|||
this._fn = fn;
|
||||
}
|
||||
|
||||
execute(injector: Injector) {
|
||||
execute(injector: Injector):void {
|
||||
var params = ListWrapper.map(this._tokens, (t) => injector.get(t));
|
||||
FunctionWrapper.apply(this._fn, params);
|
||||
}
|
||||
|
|
|
@ -26,20 +26,16 @@ bool _isCurrentTestAsync;
|
|||
bool _inIt = false;
|
||||
|
||||
class AsyncTestCompleter {
|
||||
Completer _completer;
|
||||
final _completer = new Completer();
|
||||
|
||||
AsyncTestCompleter() {
|
||||
_completer = new Completer();
|
||||
}
|
||||
|
||||
done() {
|
||||
void done() {
|
||||
_completer.complete();
|
||||
}
|
||||
|
||||
get future => _completer.future;
|
||||
Future get future => _completer.future;
|
||||
}
|
||||
|
||||
testSetup() {
|
||||
void testSetup() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
// beforeEach configuration:
|
||||
// - Priority 3: clear the bindings before each test,
|
||||
|
@ -125,7 +121,7 @@ class NotExpect extends gns.NotExpect {
|
|||
Function get _expect => gns.guinness.matchers.expect;
|
||||
}
|
||||
|
||||
beforeEach(fn) {
|
||||
void beforeEach(fn) {
|
||||
if (fn is! FunctionWithParamTokens) fn = new FunctionWithParamTokens([], fn);
|
||||
gns.beforeEach(() {
|
||||
fn.execute(_injector);
|
||||
|
@ -144,7 +140,7 @@ beforeEach(fn) {
|
|||
* bind(SomeToken).toValue(myValue),
|
||||
* ]);
|
||||
*/
|
||||
beforeEachBindings(fn) {
|
||||
void beforeEachBindings(Function fn) {
|
||||
gns.beforeEach(
|
||||
() {
|
||||
var bindings = fn();
|
||||
|
@ -154,7 +150,7 @@ beforeEachBindings(fn) {
|
|||
);
|
||||
}
|
||||
|
||||
_it(gnsFn, name, fn) {
|
||||
void _it(gnsFn, name, fn) {
|
||||
if (fn is! FunctionWithParamTokens) fn = new FunctionWithParamTokens([], fn);
|
||||
gnsFn(name, () {
|
||||
_inIt = true;
|
||||
|
@ -165,20 +161,20 @@ _it(gnsFn, name, fn) {
|
|||
}
|
||||
|
||||
|
||||
it(name, fn) {
|
||||
void it(name, fn) {
|
||||
_it(gns.it, name, fn);
|
||||
}
|
||||
|
||||
iit(name, fn) {
|
||||
void iit(name, fn) {
|
||||
_it(gns.iit, name, fn);
|
||||
}
|
||||
|
||||
xit(name, fn) {
|
||||
void xit(name, fn) {
|
||||
_it(gns.xit, name, fn);
|
||||
}
|
||||
|
||||
class SpyFunction extends gns.SpyFunction {
|
||||
SpyFunction(name): super(name);
|
||||
SpyFunction(String name): super(name);
|
||||
|
||||
// TODO: vsavkin move to guinness
|
||||
andReturn(value) {
|
||||
|
|
|
@ -9,7 +9,7 @@ export class Log {
|
|||
this._result = [];
|
||||
}
|
||||
|
||||
add(value) {
|
||||
add(value):void {
|
||||
ListWrapper.push(this._result, value);
|
||||
}
|
||||
|
||||
|
@ -19,16 +19,16 @@ export class Log {
|
|||
}
|
||||
}
|
||||
|
||||
result() {
|
||||
result():string {
|
||||
return ListWrapper.join(this._result, "; ");
|
||||
}
|
||||
}
|
||||
|
||||
export function viewRootNodes(view) {
|
||||
export function viewRootNodes(view):List {
|
||||
return view.render.delegate.rootNodes;
|
||||
}
|
||||
|
||||
export function queryView(view, selector) {
|
||||
export function queryView(view, selector:string) {
|
||||
var rootNodes = viewRootNodes(view);
|
||||
for (var i = 0; i < rootNodes.length; ++i) {
|
||||
var res = DOM.querySelector(rootNodes[i], selector);
|
||||
|
@ -43,6 +43,6 @@ export function dispatchEvent(element, eventType) {
|
|||
DOM.dispatchEvent(element, DOM.createEvent(eventType));
|
||||
}
|
||||
|
||||
export function el(html) {
|
||||
export function el(html:string) {
|
||||
return DOM.firstChild(DOM.content(DOM.createTemplate(html)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue