| 1799 | |
| 1800 | // Swap first two elements, remove the third, add new data |
| 1801 | function mutateData() { |
| 1802 | // Swap first and second data in data array |
| 1803 | const copiedData = component.dataSource.data.slice(); |
| 1804 | const temp = copiedData[0]; |
| 1805 | copiedData[0] = copiedData[1]; |
| 1806 | copiedData[1] = temp; |
| 1807 | |
| 1808 | // Remove the third element |
| 1809 | copiedData.splice(2, 1); |
| 1810 | |
| 1811 | // Add new data |
| 1812 | component.dataSource.data = copiedData; |
| 1813 | component.dataSource.addData(); |
| 1814 | } |
| 1815 | |
| 1816 | it('should add/remove/move rows with reference-based trackBy', () => { |
| 1817 | createTestComponentWithTrackyByTable('reference'); |