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

Function addInitialIndexAttribute

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

Source from the content-addressed store, hash-verified

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

Callers 1

table.spec.tsFile · 0.85

Calls 3

toStringMethod · 0.80
getRowsFunction · 0.70
getAttributeMethod · 0.65

Tested by

no test coverage detected