MCPcopy Create free account
hub / github.com/angular/angular / expectHTML

Function expectHTML

packages/core/test/acceptance/hmr_spec.ts:2378–2385  ·  view source on GitHub ↗
(element: HTMLElement, expectation: string)

Source from the content-addressed store, hash-verified

2376 }
2377
2378 function expectHTML(element: HTMLElement, expectation: string) {
2379 const actual = element.innerHTML
2380 .replace(/<!--(\W|\w)*?-->/g, '')
2381 .replace(/\s(ng-reflect|_nghost|_ngcontent)-\S*="[^"]*"/g, '');
2382 expect(actual.replace(/\s/g, '') === expectation.replace(/\s/g, ''))
2383 .withContext(`HTML does not match expectation. Actual HTML:\n${actual}`)
2384 .toBe(true);
2385 }
2386
2387 function setMarker(node: Node) {
2388 (node as any)[CREATED_INITIALLY_MARKER] = true;

Callers 1

hmr_spec.tsFile · 0.85

Calls 2

withContextMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected