From d773b6a00a2b5670600bbfd7f7d7312b760c2f83 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Tue, 26 May 2015 09:25:16 -0700 Subject: [PATCH] fixed(spy): support `SpyObject` in Typescript as well - allow `@IMPLEMENTS` as a decorator - implement empty `noSuchMethod` --- modules/angular2/src/facade/lang.ts | 7 ++++++- modules/angular2/src/test_lib/test_lib.ts | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/angular2/src/facade/lang.ts b/modules/angular2/src/facade/lang.ts index 7ce9e27ec9..bd2e1c34fd 100644 --- a/modules/angular2/src/facade/lang.ts +++ b/modules/angular2/src/facade/lang.ts @@ -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; diff --git a/modules/angular2/src/test_lib/test_lib.ts b/modules/angular2/src/test_lib/test_lib.ts index adb6a14861..727dd3f956 100644 --- a/modules/angular2/src/test_lib/test_lib.ts +++ b/modules/angular2/src/test_lib/test_lib.ts @@ -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);