${tag}>
`);
if (mainEl._overlayCtrl.placementMode === 'global') {
// Specifically checking the output in global root node, because the _contentOverlayNode still references
// the node that was removed in the teardown but hasn't been garbage collected due to reference to it still existing..
// Find the outlets that are not backdrop outlets
const outletsInGlobalRootNode = Array.from(overlays.globalRootNode.children).filter(
child =>
child.slot === '_overlay-shadow-outlet' &&
!child.classList.contains('global-overlays__backdrop'),
);
// Check the last one, which is the most nested one
const lastContentNodeInContainer =
outletsInGlobalRootNode[outletsInGlobalRootNode.length - 1];
expect(outletsInGlobalRootNode.length).to.equal(2);
// Check that it indeed has the intended content
expect(lastContentNodeInContainer.firstElementChild.innerText).to.equal(
'content of the nested overlay',
);
expect(lastContentNodeInContainer.firstElementChild.slot).to.equal('content');
} else {
const actualNestedOverlay = mainEl._overlayContentNode.firstElementChild;
const outletNode = Array.from(actualNestedOverlay.children).find(
child => child.slot === '_overlay-shadow-outlet',
);
const contentNode = Array.from(outletNode.children).find(child => child.slot === 'content');
expect(contentNode).to.not.be.undefined;
expect(contentNode.innerText).to.equal('content of the nested overlay');
}
});
});
}