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

Function setupGrid

src/aria/grid/grid.spec.ts:91–129  ·  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

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