fix(ivy): allign DebugNode.componentInstance semantics with view engine (#28756)

PR Close #28756
This commit is contained in:
Pawel Kozlowski
2019-02-15 12:01:53 +01:00
committed by Igor Minar
parent e0f3fd72dd
commit 692ddfcbb5
2 changed files with 65 additions and 4 deletions

View File

@ -7,7 +7,7 @@
*/
import {Injector} from '../di';
import {getComponent, getContext, getInjectionTokens, getInjector, getListeners, getLocalRefs, isBrowserEvents, loadLContext, loadLContextFromNode} from '../render3/discovery_utils';
import {getComponent, getContext, getInjectionTokens, getInjector, getListeners, getLocalRefs, getViewComponent, isBrowserEvents, loadLContext, loadLContextFromNode} from '../render3/discovery_utils';
import {TNode} from '../render3/interfaces/node';
import {StylingIndex} from '../render3/interfaces/styling';
import {LView, TData, TVIEW} from '../render3/interfaces/view';
@ -210,7 +210,8 @@ class DebugNode__POST_R3__ implements DebugNode {
get componentInstance(): any {
const nativeElement = this.nativeNode;
return nativeElement && getComponent(nativeElement as Element);
return nativeElement &&
(getComponent(nativeElement as Element) || getViewComponent(nativeElement));
}
get context(): any { return getContext(this.nativeNode as Element); }