| 1758 | |
| 1759 | // Swap first two elements, remove the third, add new data |
| 1760 | function mutateData() { |
| 1761 | // Swap first and second data in data array |
| 1762 | const copiedData = component.dataSource.data.slice(); |
| 1763 | const temp = copiedData[0]; |
| 1764 | copiedData[0] = copiedData[1]; |
| 1765 | copiedData[1] = temp; |
| 1766 | |
| 1767 | // Remove the third element |
| 1768 | copiedData.splice(2, 1); |
| 1769 | |
| 1770 | // Add new data |
| 1771 | component.dataSource.data = copiedData; |
| 1772 | component.dataSource.addData(); |
| 1773 | } |
| 1774 | |
| 1775 | it('should add/remove/move rows with reference-based trackBy', () => { |
| 1776 | createTestComponentWithTrackyByTable('reference'); |