(
tagName: string,
attrName: keyof typeof attrCarriers,
staticAttributeName: string,
)
| 712 | // `hostElement` keeps the tag name out of the template, which lets the cases below be table |
| 713 | // driven. Returns the change detection call so the caller can assert on it. |
| 714 | function bindAttributeOutsideSvg( |
| 715 | tagName: string, |
| 716 | attrName: keyof typeof attrCarriers, |
| 717 | staticAttributeName: string, |
| 718 | ): () => void { |
| 719 | @Component({ |
| 720 | template: '', |
| 721 | }) |
| 722 | class DynamicHost {} |
| 723 | |
| 724 | const hostElement = document.createElement(tagName); |
| 725 | hostElement.setAttribute('attributeName', staticAttributeName); |
| 726 | |
| 727 | const componentRef = createComponent(DynamicHost, { |
| 728 | hostElement, |
| 729 | environmentInjector: TestBed.inject(EnvironmentInjector), |
| 730 | directives: [attrCarriers[attrName]], |
| 731 | }); |
| 732 | |
| 733 | return () => { |
| 734 | try { |
| 735 | componentRef.changeDetectorRef.detectChanges(); |
| 736 | } finally { |
| 737 | componentRef.destroy(); |
| 738 | } |
| 739 | }; |
| 740 | } |
| 741 | |
| 742 | // An animation element declared outside of an `<svg>` is created in the HTML namespace, but still |
| 743 | // animates once it ends up inside an `<svg>` subtree - for example when it is projected into one |
no test coverage detected