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

Function replaceMetadata

packages/core/test/acceptance/hmr_spec.ts:2359–2376  ·  view source on GitHub ↗
(type: Type<unknown>, metadata: Component)

Source from the content-addressed store, hash-verified

2357 const CREATED_INITIALLY_MARKER = '__ngCreatedInitially__';
2358
2359 function replaceMetadata(type: Type<unknown>, metadata: Component) {
2360 ɵɵreplaceMetadata(
2361 type,
2362 () => {
2363 // TODO: the content of this callback is a hacky workaround to invoke the compiler in a test.
2364 // in reality the callback will be generated by the compiler to be something along the lines
2365 // of `MyComp[ɵcmp] = /* metadata */`.
2366 // TODO: in reality this callback should also include `setClassMetadata` and
2367 // `setClassDebugInfo`.
2368 (type as any)[ɵNG_COMP_DEF] = null;
2369 compileComponent(type, metadata);
2370 },
2371 [angularCoreEnv],
2372 [],
2373 null,
2374 '',
2375 );
2376 }
2377
2378 function expectHTML(element: HTMLElement, expectation: string) {
2379 const actual = element.innerHTML

Callers 1

hmr_spec.tsFile · 0.85

Calls 2

ɵɵreplaceMetadataFunction · 0.90
compileComponentFunction · 0.90

Tested by

no test coverage detected