fix(debug): make debug tools take ComponentRef

The debug tools used to take ApplicationRefs, which are the old return
type of bootstrap. Now bootstrap returns ComponentRef, so the debug
tools should be updated.

Closes #4203
This commit is contained in:
Harry Terkelsen
2015-09-15 17:13:48 -07:00
committed by Harry Terkelsen
parent 8f985dd558
commit 70586b668c
7 changed files with 25 additions and 23 deletions
+9 -9
View File
@@ -1,6 +1,7 @@
import 'package:angular2/test_lib.dart' show SpyObject;
import 'package:angular2/core.dart'
show ApplicationRef, LifeCycle, Injector, bind;
import 'package:angular2/core.dart' show LifeCycle, Injector, bind;
import 'package:angular2/src/core/compiler/dynamic_component_loader.dart'
show ComponentRef;
import 'dart:js';
@proxy
@@ -9,19 +10,18 @@ class SpyLifeCycle extends SpyObject implements LifeCycle {
}
@proxy
class SpyApplicationRef extends SpyObject implements ApplicationRef {
class SpyComponentRef extends SpyObject implements ComponentRef {
Injector injector;
SpyApplicationRef() {
this.injector = Injector.resolveAndCreate([
bind(LifeCycle).toClass(SpyLifeCycle)
]);
SpyComponentRef() {
this.injector =
Injector.resolveAndCreate([bind(LifeCycle).toClass(SpyLifeCycle)]);
}
noSuchMethod(m) => super.noSuchMethod(m);
}
void callNgProfilerTimeChangeDetection([config]) {
context['ng']['profiler'].callMethod('timeChangeDetection',
config != null ? [config] : []);
context['ng']['profiler']
.callMethod('timeChangeDetection', config != null ? [config] : []);
}
+3 -2
View File
@@ -1,8 +1,9 @@
import {SpyObject} from 'angular2/test_lib';
import {ApplicationRef, LifeCycle, Injector, bind} from 'angular2/angular2';
import {LifeCycle, Injector, bind} from 'angular2/angular2';
import {ComponentRef} from 'angular2/src/core/compiler/dynamic_component_loader';
import {global} from 'angular2/src/core/facade/lang';
export class SpyApplicationRef extends SpyObject {
export class SpyComponentRef extends SpyObject {
injector;
constructor() {
super();
+2 -2
View File
@@ -11,11 +11,11 @@ import {
} from 'angular2/test_lib';
import {enableDebugTools, disableDebugTools} from 'angular2/tools';
import {SpyApplicationRef, callNgProfilerTimeChangeDetection} from './spies';
import {SpyComponentRef, callNgProfilerTimeChangeDetection} from './spies';
export function main() {
describe('profiler', () => {
beforeEach(() => { enableDebugTools((<any>new SpyApplicationRef())); });
beforeEach(() => { enableDebugTools((<any>new SpyComponentRef())); });
afterEach(() => { disableDebugTools(); });