MCPcopy Index your code
hub / github.com/angular/angular / html

Function html

packages/upgrade/src/common/test/helpers/common_test_helpers.ts:152–164  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

150}
151
152export function html(html: string): Element {
153 // Don't return `body` itself, because using it as a `$rootElement` for ng1
154 // will attach `$injector` to it and that will affect subsequent tests.
155 const body = document.body;
156 body.innerHTML = `<div>${html.trim()}</div>`;
157 const div = document.body.firstChild as Element;
158
159 if (div.childNodes.length === 1 && div.firstChild instanceof HTMLElement) {
160 return div.firstChild;
161 }
162
163 return div;
164}
165
166export function multiTrim(text: string | null | undefined, allSpace = false): string {
167 if (typeof text == 'string') {

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…