* Converts a tNode to a helpful readable string value for use in error messages * * @param tNode a given TNode * @param innerContent the content of the node * @returns string
(tNode: TNode, innerContent: string = '…')
| 290 | * @returns string |
| 291 | */ |
| 292 | function describeTNode(tNode: TNode, innerContent: string = '…'): string { |
| 293 | switch (tNode.type) { |
| 294 | case TNodeType.Text: |
| 295 | const content = tNode.value ? `(${tNode.value})` : ''; |
| 296 | return `#text${content}`; |
| 297 | case TNodeType.Element: |
| 298 | const attrs = stringifyTNodeAttrs(tNode); |
| 299 | const tag = tNode.value.toLowerCase(); |
| 300 | return `<${tag}${attrs ? ' ' + attrs : ''}>${innerContent}</${tag}>`; |
| 301 | case TNodeType.ElementContainer: |
| 302 | return '<!-- ng-container -->'; |
| 303 | case TNodeType.Container: |
| 304 | return '<!-- container -->'; |
| 305 | default: |
| 306 | const typeAsString = getFriendlyStringFromTNodeType(tNode.type); |
| 307 | return `#node(${typeAsString})`; |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * Converts an RNode to a helpful readable string value for use in error messages |
no test coverage detected
searching dependent graphs…