(
tagName: string,
attrName: keyof typeof attrCarriers,
staticAttributeName: string,
)
| 727 | // `hostElement` keeps the tag name out of the template, which lets the cases below be table |
| 728 | // driven. Returns the change detection call so the caller can assert on it. |
| 729 | function bindAttributeOutsideSvg( |
| 730 | tagName: string, |
| 731 | attrName: keyof typeof attrCarriers, |
| 732 | staticAttributeName: string, |
| 733 | ): () => void { |
| 734 | @Component({ |
| 735 | template: '', |
| 736 | changeDetection: ChangeDetectionStrategy.Eager, |
| 737 | }) |
| 738 | class DynamicHost {} |
| 739 | |
| 740 | const hostElement = document.createElement(tagName); |
| 741 | hostElement.setAttribute('attributeName', staticAttributeName); |
| 742 | |
| 743 | const componentRef = createComponent(DynamicHost, { |
| 744 | hostElement, |
| 745 | environmentInjector: TestBed.inject(EnvironmentInjector), |
| 746 | directives: [attrCarriers[attrName]], |
| 747 | }); |
| 748 | |
| 749 | return () => { |
| 750 | try { |
| 751 | componentRef.changeDetectorRef.detectChanges(); |
| 752 | } finally { |
| 753 | componentRef.destroy(); |
| 754 | } |
| 755 | }; |
| 756 | } |
| 757 | |
| 758 | // An animation element declared outside of an `<svg>` is created in the HTML namespace, but still |
| 759 | // animates once it ends up inside an `<svg>` subtree - for example when it is projected into one |
no test coverage detected