X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/angular2/src/core/testability/testability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ export class TestabilityRegistry {

getAllTestabilities(): Testability[] { return MapWrapper.values(this._applications); }

getAllRootElements(): any[] { return MapWrapper.keys(this._applications); }

findTestabilityInTree(elem: Node, findInAncestors: boolean = true): Testability {
return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
}
Expand Down
1 change: 1 addition & 0 deletions modules/angular2/src/facade/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface BrowserNodeGlobal {
Zone: ZoneLikeConstructor;
getAngularTestability: Function;
getAllAngularTestabilities: Function;
getAllAngularRootElements: Function;
frameworkStabilizers: Array<Function>;
setTimeout: Function;
clearTimeout: Function;
Expand Down
2 changes: 2 additions & 0 deletions modules/angular2/src/platform/browser/testability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export class BrowserGetTestability implements GetTestability {
return testabilities.map((testability) => { return new PublicTestability(testability); });
};

global.getAllAngularRootElements = () => registry.getAllRootElements();

var whenAllStable = (callback) => {
var testabilities = global.getAllAngularTestabilities();
var count = testabilities.length;
Expand Down
5 changes: 4 additions & 1 deletion modules/angular2/src/platform/dom/debug/ng_probe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import {Injectable, provide, Provider} from 'angular2/src/core/di';
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
import {DebugNode, getDebugNode} from 'angular2/src/core/debug/debug_node';
import {DomRootRenderer} from 'angular2/src/platform/dom/dom_renderer';
import {RootRenderer} from 'angular2/core';
import {RootRenderer, NgZone, ApplicationRef} from 'angular2/core';
import {DebugDomRootRenderer} from 'angular2/src/core/debug/debug_renderer';

const CORE_TOKENS = CONST_EXPR({'ApplicationRef': ApplicationRef, 'NgZone': NgZone});

const INSPECT_GLOBAL_NAME = 'ng.probe';
const CORE_TOKENS_GLOBAL_NAME = 'ng.coreTokens';

/**
* Returns a {@link DebugElement} for the given native DOM element, or
Expand All @@ -27,6 +29,7 @@ function _createConditionalRootRenderer(rootRenderer) {

function _createRootRenderer(rootRenderer) {
DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
DOM.setGlobalVar(CORE_TOKENS_GLOBAL_NAME, CORE_TOKENS);
return new DebugDomRootRenderer(rootRenderer);
}

Expand Down
1 change: 1 addition & 0 deletions modules/angular2/test/public_api_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,7 @@ var NG_CORE = [
'TestabilityRegistry',
'TestabilityRegistry.findTestabilityInTree()',
'TestabilityRegistry.getAllTestabilities()',
'TestabilityRegistry.getAllRootElements()',
'TestabilityRegistry.getTestability()',
'TestabilityRegistry.registerApplication()',
'GetTestability:dart',
Expand Down
1 change: 1 addition & 0 deletions tools/public_api_guard/public_api_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ const CORE = [
'TestabilityRegistry.constructor()',
'TestabilityRegistry.findTestabilityInTree(elem:Node, findInAncestors:boolean):Testability',
'TestabilityRegistry.getAllTestabilities():Testability[]',
'TestabilityRegistry.getAllRootElements():any[]',
'TestabilityRegistry.getTestability(elem:any):Testability',
'TestabilityRegistry.registerApplication(token:any, testability:Testability):any',
'TrackByFn',
Expand Down
X Tutup