MCPcopy
hub / github.com/angular/angular / styleCount

Function styleCount

packages/platform-browser/test/dom/dom_renderer_spec.ts:409–428  ·  view source on GitHub ↗
(
  fixture: ComponentFixture<unknown>,
  cssContentMatcher: string,
)

Source from the content-addressed store, hash-verified

407});
408
409async function styleCount(
410 fixture: ComponentFixture<unknown>,
411 cssContentMatcher: string,
412): Promise<number> {
413 // flush
414 await new Promise<void>((resolve) => {
415 setTimeout(() => resolve(), 0);
416 });
417
418 const html = fixture.debugElement.parent?.parent;
419 const debugElements = html?.queryAll(By.css('style'));
420
421 if (!debugElements) {
422 return 0;
423 }
424
425 return debugElements.filter(({nativeElement}) =>
426 nativeElement.textContent.includes(cssContentMatcher),
427 ).length;
428}
429
430@Component({
431 selector: 'cmp-emulated',

Callers 1

Calls 5

setTimeoutFunction · 0.85
queryAllMethod · 0.80
cssMethod · 0.80
resolveFunction · 0.50
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…