* Renders `content` as the content of a container whose `[slot-a]` slot is hidden, * while its `[slot-b]` and default slots are visible, and hydrates the result.
(content: string)
| 5638 | * while its `[slot-b]` and default slots are visible, and hydrates the result. |
| 5639 | */ |
| 5640 | async function ssrAndHydrate(content: string): Promise<HTMLElement> { |
| 5641 | @Component({ |
| 5642 | selector: 'app-container', |
| 5643 | template: ` |
| 5644 | @if (false) { |
| 5645 | <ng-content select="[slot-a]" /> |
| 5646 | } |
| 5647 | <ng-content select="[slot-b]" /> |
| 5648 | <ng-content /> |
| 5649 | `, |
| 5650 | }) |
| 5651 | class ContainerComponent {} |
| 5652 | |
| 5653 | @Component({ |
| 5654 | selector: 'app-wrapper', |
| 5655 | imports: [ContainerComponent, RemoveFromDom], |
| 5656 | template: `<app-container>${content}</app-container>`, |
| 5657 | }) |
| 5658 | class WrapperComponent {} |
| 5659 | |
| 5660 | @Component({ |
| 5661 | selector: 'app', |
| 5662 | imports: [WrapperComponent], |
| 5663 | template: `<app-wrapper>projected text</app-wrapper>`, |
| 5664 | }) |
| 5665 | class SimpleComponent {} |
| 5666 | |
| 5667 | const html = await ssr(SimpleComponent); |
| 5668 | const ssrContents = getAppContents(html); |
| 5669 | |
| 5670 | expect(ssrContents).toContain('<app ngh'); |
| 5671 | |
| 5672 | resetTViewsFor(SimpleComponent, WrapperComponent, ContainerComponent); |
| 5673 | |
| 5674 | const appRef = await prepareEnvironmentAndHydrate(doc, html, SimpleComponent); |
| 5675 | const compRef = getComponentRef<SimpleComponent>(appRef); |
| 5676 | await appRef.whenStable(); |
| 5677 | |
| 5678 | const clientRootNode = compRef.location.nativeElement; |
| 5679 | verifyAllNodesClaimedForHydration(clientRootNode); |
| 5680 | verifyClientAndSSRContentsMatch(ssrContents, clientRootNode); |
| 5681 | return clientRootNode; |
| 5682 | } |
| 5683 | |
| 5684 | it('should hydrate a node after <ng-content> and a node that is not projected (multi-slot)', async () => { |
| 5685 | const clientRootNode = await ssrAndHydrate(` |
no test coverage detected