refactor(testability): rename function to get testability
Previously, getting testability was `window.angular2.getTestability`
This was because the plan was to export the API to the window as
angular2. However, the decision was changed to make this just `angular`
in 3177576ad6
To decouple testability from the rest of the Angular API, just make it
one function, `window.getAngularTestability`.
This commit is contained in:
parent
a97a2266d3
commit
817c79ca77
|
@ -85,12 +85,9 @@ class PublicTestability implements _JsObjectProxyable {
|
||||||
|
|
||||||
class GetTestability {
|
class GetTestability {
|
||||||
static addToWindow(TestabilityRegistry registry) {
|
static addToWindow(TestabilityRegistry registry) {
|
||||||
js.context['angular2'] = _jsify({
|
js.context['getAngularTestability'] = _jsify((Element elem) {
|
||||||
'getTestability': (Element elem) {
|
|
||||||
Testability testability = registry.findTestabilityInTree(elem);
|
Testability testability = registry.findTestabilityInTree(elem);
|
||||||
return _jsify(new PublicTestability(testability));
|
return _jsify(new PublicTestability(testability));
|
||||||
},
|
|
||||||
'resumeBootstrap': ([arg]) {},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,7 @@ class PublicTestability {
|
||||||
|
|
||||||
export class GetTestability {
|
export class GetTestability {
|
||||||
static addToWindow(registry: TestabilityRegistry) {
|
static addToWindow(registry: TestabilityRegistry) {
|
||||||
if (!global.angular2) {
|
global.getAngularTestability = function(elem): PublicTestability {
|
||||||
global.angular2 = {};
|
|
||||||
}
|
|
||||||
global.angular2.getTestability = function(elem): PublicTestability {
|
|
||||||
var testability = registry.findTestabilityInTree(elem);
|
var testability = registry.findTestabilityInTree(elem);
|
||||||
|
|
||||||
if (testability == null) {
|
if (testability == null) {
|
||||||
|
@ -30,9 +27,5 @@ export class GetTestability {
|
||||||
}
|
}
|
||||||
return new PublicTestability(testability);
|
return new PublicTestability(testability);
|
||||||
};
|
};
|
||||||
global.angular2.resumeBootstrap = function() {
|
|
||||||
// Intentionally left blank. This will allow Protractor to run
|
|
||||||
// against angular2 without turning off Angular synchronization.
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue