refactor(test): Remove unnecessary `noSuchMethod`

Remove trivial implementations in many spy objects which just calls the
parent's `noSuchMethod`.

Closes #6410

Closes #6491
This commit is contained in:
Tim Blasi 2016-01-12 11:36:58 -08:00 committed by Timothy Blasi
parent bd015f14e8
commit e19b31db29
9 changed files with 27 additions and 88 deletions

View File

@ -6,9 +6,7 @@ import 'package:angular2/core.dart' show ChangeDetectorRef;
import 'package:angular2/common.dart' show ObservableListDiffFactory;
@proxy
class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {}
main() {
describe('ObservableListDiff', () {

View File

@ -5,16 +5,10 @@ import 'package:angular2/src/core/change_detection/change_detection.dart';
import 'package:angular2/testing_internal.dart';
@proxy
class SpyNgControl extends SpyObject implements NgControl {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyNgControl extends SpyObject implements NgControl {}
@proxy
class SpyValueAccessor extends SpyObject implements ControlValueAccessor {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyValueAccessor extends SpyObject implements ControlValueAccessor {}
@proxy
class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {}

View File

@ -5,11 +5,7 @@ import 'package:angular2/testing_internal.dart';
import 'package:angular2/src/compiler/template_compiler.dart';
@proxy
class SpyXHR extends SpyObject implements XHR {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyXHR extends SpyObject implements XHR {}
@proxy
class SpyTemplateCompiler extends SpyObject implements TemplateCompiler {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyTemplateCompiler extends SpyObject implements TemplateCompiler {}

View File

@ -13,77 +13,47 @@ import 'package:angular2/src/platform/dom/dom_adapter.dart';
import 'package:angular2/testing_internal.dart';
@proxy
class SpyDependencyProvider extends SpyObject implements DependencyProvider {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyDependencyProvider extends SpyObject implements DependencyProvider {}
@proxy
class SpyChangeDetector extends SpyObject implements ChangeDetector {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyChangeDetector extends SpyObject implements ChangeDetector {}
@proxy
class SpyChangeDispatcher extends SpyObject implements ChangeDispatcher {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyChangeDispatcher extends SpyObject implements ChangeDispatcher {}
@proxy
class SpyIterableDifferFactory extends SpyObject
implements IterableDifferFactory {
noSuchMethod(m) => super.noSuchMethod(m);
}
implements IterableDifferFactory {}
@proxy
class SpyInjector extends SpyObject implements Injector {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyInjector extends SpyObject implements Injector {}
@proxy
class SpyDirectiveResolver extends SpyObject implements DirectiveResolver {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyDirectiveResolver extends SpyObject implements DirectiveResolver {}
@proxy
class SpyView extends SpyObject implements AppView {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyView extends SpyObject implements AppView {}
@proxy
class SpyProtoView extends SpyObject implements AppProtoView {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyProtoView extends SpyObject implements AppProtoView {}
@proxy
class SpyHostViewFactory extends SpyObject implements HostViewFactory {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyHostViewFactory extends SpyObject implements HostViewFactory {}
@proxy
class SpyElementRef extends SpyObject implements ElementRef {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyElementRef extends SpyObject implements ElementRef {}
@proxy
class SpyAppViewManager extends SpyObject implements AppViewManager_ {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyAppViewManager extends SpyObject implements AppViewManager_ {}
@proxy
class SpyRenderer extends SpyObject implements Renderer {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyRenderer extends SpyObject implements Renderer {}
@proxy
class SpyRootRenderer extends SpyObject implements RootRenderer {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyRootRenderer extends SpyObject implements RootRenderer {}
@proxy
class SpyAppViewListener extends SpyObject implements AppViewListener {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyAppViewListener extends SpyObject implements AppViewListener {}
@proxy
class SpyDomAdapter extends SpyObject implements DomAdapter {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyDomAdapter extends SpyObject implements DomAdapter {}

View File

@ -8,7 +8,6 @@ import 'dart:js';
@proxy
class SpyApplicationRef extends SpyObject implements ApplicationRef {
tick() {}
noSuchMethod(m) => super.noSuchMethod(m);
}
@proxy
@ -16,11 +15,9 @@ class SpyComponentRef extends SpyObject implements ComponentRef_ {
Injector injector;
SpyComponentRef() {
this.injector =
Injector.resolveAndCreate([bind(ApplicationRef).toClass(SpyApplicationRef)]);
this.injector = Injector
.resolveAndCreate([bind(ApplicationRef).toClass(SpyApplicationRef)]);
}
noSuchMethod(m) => super.noSuchMethod(m);
}
void callNgProfilerTimeChangeDetection([config]) {

View File

@ -4,21 +4,14 @@ import 'package:angular2/router.dart';
import 'package:angular2/testing_internal.dart';
@proxy
class SpyLocation extends SpyObject implements Location {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyLocation extends SpyObject implements Location {}
@proxy
class SpyRouter extends SpyObject implements Router {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyRouter extends SpyObject implements Router {}
@proxy
class SpyRouterOutlet extends SpyObject implements RouterOutlet {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyRouterOutlet extends SpyObject implements RouterOutlet {}
class SpyPlatformLocation extends SpyObject implements PlatformLocation {
String pathname;
noSuchMethod(m) => super.noSuchMethod(m);
}

View File

@ -24,7 +24,6 @@ class TestObj {
class SpyTestObj extends SpyObject {
constructor() { super(TestObj); }
noSuchMethod(m) { return super.noSuchMethod(m) }
}

View File

@ -60,15 +60,9 @@ main() {
@proxy
class SpyMessageEvent extends SpyObject implements MessageEvent {
SpyMessageEvent() : super(SpyMessageEvent);
noSuchMethod(m) {
return super.noSuchMethod(m);
}
}
@proxy
class SpyWebSocket extends SpyObject implements WebSocket {
SpyWebSocket() : super(SpyWebSocket);
noSuchMethod(m) {
return super.noSuchMethod(m);
}
}

View File

@ -4,6 +4,4 @@ import 'package:angular2/src/web_workers/shared/client_message_broker.dart';
import 'package:angular2/testing_internal.dart';
@proxy
class SpyMessageBroker extends SpyObject implements ClientMessageBroker {
noSuchMethod(m) => super.noSuchMethod(m);
}
class SpyMessageBroker extends SpyObject implements ClientMessageBroker {}