feat(test): add element probe

Usage: bootstrap the app with the special binding
`ELEMENT_PROBE_CONFIG` from `angular2/debug`.
This will provide a global method `ngProbe(element)` that
will expose a `DebugElement` with directive instances, ... on it.

During tests that use Angular's test injector, the probe is
enabled by default. The `DebugElement ` can be retrieved via the
function `inspectDomElement` of `angular2/debug`. Note
that the `TestComponentBuilder` already returns `DebugElement `s.

Closes #1992
This commit is contained in:
Tobias Bosch
2015-05-28 15:02:20 -07:00
parent 24bc4b66d0
commit f9908cd436
11 changed files with 669 additions and 458 deletions

View File

@ -258,9 +258,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
setData(element, name: string, value: string) { element.dataset[name] = value; }
getData(element, name: string): string { return element.dataset[name]; }
// TODO(tbosch): move this into a separate environment class once we have it
setGlobalVar(name: string, value: any) {
global[name] = value;
}
setGlobalVar(name: string, value: any) { global[name] = value; }
}
// based on urlUtils.js in AngularJS 1