File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ implements DebugEleme
247
247
return this . nativeNode . nodeType == Node . ELEMENT_NODE ? this . nativeNode as Element : null ;
248
248
}
249
249
250
- get name ( ) : string { return this . nativeElement ! . nodeName ; }
250
+ get name ( ) : string { return this . nativeNode . nodeName ; }
251
251
252
252
/**
253
253
* Gets a map of property names to property values for an element.
Original file line number Diff line number Diff line change @@ -1018,4 +1018,22 @@ class TestCmptWithPropBindings {
1018
1018
} ) ;
1019
1019
1020
1020
} ) ;
1021
+
1022
+ it ( 'should not error when accessing node name' , ( ) => {
1023
+ @Component ( { template : '' } )
1024
+ class EmptyComponent {
1025
+ }
1026
+
1027
+ const fixture = TestBed . configureTestingModule ( { declarations : [ EmptyComponent ] } )
1028
+ . createComponent ( EmptyComponent ) ;
1029
+ let node = fixture . debugElement ;
1030
+ let superParentName = '' ;
1031
+ // Traverse upwards, all the way to #document, which is not a
1032
+ // Node.ELEMENT_NODE
1033
+ while ( node ) {
1034
+ superParentName = node . name ;
1035
+ node = node . parent ! ;
1036
+ }
1037
+ expect ( superParentName ) . not . toEqual ( '' ) ;
1038
+ } ) ;
1021
1039
}
You can’t perform that action at this time.
0 commit comments