MCPcopy Create free account
hub / github.com/angular/components / createComponent

Function createComponent

src/material/chips/chip-listbox.spec.ts:929–954  ·  view source on GitHub ↗
(
    component: Type<T>,
    direction: Direction = 'ltr',
    beforeInitialChangeDetection?: (fixture: ComponentFixture<T>) => void,
  )

Source from the content-addressed store, hash-verified

927 });
928
929 function createComponent<T>(
930 component: Type<T>,
931 direction: Direction = 'ltr',
932 beforeInitialChangeDetection?: (fixture: ComponentFixture<T>) => void,
933 ): ComponentFixture<T> {
934 directionality = signal(direction);
935
936 TestBed.configureTestingModule({
937 providers: [provideFakeDirectionality(directionality)],
938 });
939
940 const fixture = TestBed.createComponent<T>(component);
941 beforeInitialChangeDetection?.(fixture);
942 fixture.detectChanges();
943
944 chipListboxDebugElement = fixture.debugElement.query(By.directive(MatChipListbox))!;
945 chipListboxNativeElement = chipListboxDebugElement.nativeElement;
946 chipListboxInstance = chipListboxDebugElement.componentInstance;
947 testComponent = fixture.debugElement.componentInstance;
948 chips = chipListboxInstance._chips;
949 primaryActions = chipListboxNativeElement.querySelectorAll<HTMLElement>(
950 '.mdc-evolution-chip__action--primary',
951 );
952
953 return fixture;
954 }
955});
956
957@Component({

Callers 1

Calls 2

signalFunction · 0.85

Tested by

no test coverage detected