(html: string)
| 150 | } |
| 151 | |
| 152 | export 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 | |
| 166 | export function multiTrim(text: string | null | undefined, allSpace = false): string { |
| 167 | if (typeof text == 'string') { |
no outgoing calls
no test coverage detected
searching dependent graphs…