in projects/libs/flex-layout/_private-utils/testing/custom-matchers.ts [271:298]
function elementText(n: any): string {
const hasNodes = (m: any) => {
const children = _.childNodes(m);
return children && children['length'];
};
if (n instanceof Array) {
return n.map(elementText).join('');
}
if (_.isCommentNode(n)) {
return '';
}
if (_.isElementNode(n) && _.tagName(n) == 'CONTENT') {
return elementText(Array.prototype.slice.apply(_.getDistributedNodes(n)));
}
if (_.hasShadowRoot(n)) {
return elementText(_.childNodesAsList(_.getShadowRoot(n)));
}
if (hasNodes(n)) {
return elementText(_.childNodesAsList(n));
}
return _.getText(n);
}