[Tables] Added telemetry buffer so that subscription data is not discarded if it's beyond the end bounds

This commit is contained in:
Henry
2017-01-23 12:43:59 -08:00
parent ae2b73a4f5
commit 6cd99efbb9
5 changed files with 152 additions and 114 deletions

View File

@ -465,20 +465,20 @@ define(
mockScope.displayRows = controller.sortRows(testRows.slice(0));
mockScope.rows.push(row4);
controller.addRow(undefined, mockScope.rows.length - 1);
controller.addRows(undefined, mockScope.rows.length - 1);
expect(mockScope.displayRows[0].col2.text).toEqual('xyz');
mockScope.rows.push(row5);
controller.addRow(undefined, mockScope.rows.length - 1);
controller.addRows(undefined, mockScope.rows.length - 1);
expect(mockScope.displayRows[4].col2.text).toEqual('aaa');
mockScope.rows.push(row6);
controller.addRow(undefined, mockScope.rows.length - 1);
controller.addRows(undefined, mockScope.rows.length - 1);
expect(mockScope.displayRows[2].col2.text).toEqual('ggg');
//Add a duplicate row
mockScope.rows.push(row6);
controller.addRow(undefined, mockScope.rows.length - 1);
controller.addRows(undefined, mockScope.rows.length - 1);
expect(mockScope.displayRows[2].col2.text).toEqual('ggg');
expect(mockScope.displayRows[3].col2.text).toEqual('ggg');
});
@ -494,12 +494,12 @@ define(
mockScope.displayRows = controller.filterRows(testRows);
mockScope.rows.push(row5);
controller.addRow(undefined, mockScope.rows.length - 1);
controller.addRows(undefined, mockScope.rows.length - 1);
expect(mockScope.displayRows.length).toBe(2);
expect(mockScope.displayRows[1].col2.text).toEqual('aaa');
mockScope.rows.push(row6);
controller.addRow(undefined, mockScope.rows.length - 1);
controller.addRows(undefined, mockScope.rows.length - 1);
expect(mockScope.displayRows.length).toBe(2);
//Row was not added because does not match filter
});
@ -513,11 +513,11 @@ define(
mockScope.displayRows = testRows.slice(0);
mockScope.rows.push(row5);
controller.addRow(undefined, mockScope.rows.length - 1);
controller.addRows(undefined, mockScope.rows.length - 1);
expect(mockScope.displayRows[3].col2.text).toEqual('aaa');
mockScope.rows.push(row6);
controller.addRow(undefined, mockScope.rows.length - 1);
controller.addRows(undefined, mockScope.rows.length - 1);
expect(mockScope.displayRows[4].col2.text).toEqual('ggg');
});
@ -536,7 +536,7 @@ define(
mockScope.displayRows = testRows.slice(0);
mockScope.rows.push(row7);
controller.addRow(undefined, mockScope.rows.length - 1);
controller.addRows(undefined, mockScope.rows.length - 1);
expect(controller.$scope.sizingRow.col2).toEqual({text: 'some longer string'});
});