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

Function addInitialIndexAttribute

src/cdk/table/table.spec.ts:159–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157
158 describe('should correctly use the differ to add/remove/move rows', () => {
159 function addInitialIndexAttribute() {
160 // Each row receives an attribute 'initialIndex' the element's original place
161 getRows(tableElement).forEach((row: Element, index: number) => {
162 row.setAttribute('initialIndex', index.toString());
163 });
164
165 // Prove that the attributes match their indicies
166 const initialRows = getRows(tableElement);
167 expect(initialRows[0].getAttribute('initialIndex')).toBe('0');
168 expect(initialRows[1].getAttribute('initialIndex')).toBe('1');
169 expect(initialRows[2].getAttribute('initialIndex')).toBe('2');
170 }
171
172 it('when the data is heterogeneous', () => {
173 addInitialIndexAttribute();

Callers 1

table.spec.tsFile · 0.85

Calls 3

toStringMethod · 0.80
getRowsFunction · 0.70
getAttributeMethod · 0.65

Tested by

no test coverage detected