MCPcopy
hub / github.com/angular/components / setupGrid

Function setupGrid

src/aria/grid/grid.spec.ts:90–128  ·  view source on GitHub ↗
(opts?: {
    disabled?: boolean;
    multi?: boolean;
    rowWrap?: 'continuous' | 'loop' | 'nowrap';
    colWrap?: 'continuous' | 'loop' | 'nowrap';
    focusMode?: 'roving' | 'activedescendant';
    softDisabled?: boolean;
    enableSelection?: boolean;
    selectionMode?: 'follow' | 'explicit';
    gridData?: RowConfig[];
    tabIndex?: number;
  })

Source from the content-addressed store, hash-verified

88 }
89
90 async function setupGrid(opts?: {
91 disabled?: boolean;
92 multi?: boolean;
93 rowWrap?: 'continuous' | 'loop' | 'nowrap';
94 colWrap?: 'continuous' | 'loop' | 'nowrap';
95 focusMode?: 'roving' | 'activedescendant';
96 softDisabled?: boolean;
97 enableSelection?: boolean;
98 selectionMode?: 'follow' | 'explicit';
99 gridData?: RowConfig[];
100 tabIndex?: number;
101 }) {
102 TestBed.resetTestingModule();
103 TestBed.configureTestingModule({});
104 fixture = TestBed.createComponent(GridTestComponent);
105 const testComponent = fixture.componentInstance;
106
107 if (opts?.disabled !== undefined) testComponent.disabled.set(opts.disabled);
108 if (opts?.multi !== undefined) testComponent.multi.set(opts.multi);
109 if (opts?.rowWrap !== undefined) testComponent.rowWrap.set(opts.rowWrap);
110 if (opts?.colWrap !== undefined) testComponent.colWrap.set(opts.colWrap);
111 if (opts?.focusMode !== undefined) testComponent.focusMode.set(opts.focusMode);
112 if (opts?.softDisabled !== undefined) testComponent.softDisabled.set(opts.softDisabled);
113 if (opts?.enableSelection !== undefined)
114 testComponent.enableSelection.set(opts.enableSelection);
115 if (opts?.selectionMode !== undefined) testComponent.selectionMode.set(opts.selectionMode);
116 if (opts?.tabIndex !== undefined) testComponent.tabIndex.set(opts.tabIndex);
117
118 if (opts?.gridData !== undefined) {
119 testComponent.gridData.set(opts.gridData);
120 } else {
121 testComponent.gridData.set(createGridData());
122 }
123
124 await fixture.whenStable();
125 gridDebugElement = fixture.debugElement.query(By.directive(Grid));
126 gridElement = gridDebugElement.nativeElement;
127 gridInstance = gridDebugElement.injector.get(Grid);
128 }
129
130 describe('Grid', () => {
131 describe('ARIA attributes and roles', () => {

Callers 1

grid.spec.tsFile · 0.70

Calls 3

setMethod · 0.80
createGridDataFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…