fixed(spy): support `SpyObject` in Typescript as well

- allow `@IMPLEMENTS` as a decorator
- implement empty `noSuchMethod`
This commit is contained in:
Tobias Bosch 2015-05-26 09:25:16 -07:00
parent f6cd26b0a6
commit d773b6a00a
2 changed files with 9 additions and 1 deletions

View File

@ -45,7 +45,12 @@ export function CONST() {
export class ABSTRACT {}
export class IMPLEMENTS {}
// Note: This is only a marker annotation needed for ts2dart.
// This is written so that is can be used as a Traceur annotation
// or a Typescript decorator.
export function IMPLEMENTS(_) {
return (t) => t;
}
export function isPresent(obj): boolean {
return obj !== undefined && obj !== null;

View File

@ -299,6 +299,9 @@ export class SpyObject {
}
}
}
// Noop so that SpyObject has the smae interface as in Dart
noSuchMethod(args) {}
spy(name) {
if (!this[name]) {
this[name] = this._createGuinnessCompatibleSpy(name);