mirror of
https://github.com/nasa/openmct.git
synced 2025-06-21 08:39:59 +00:00
Merge pull request #918 from nasa/rt-updates-910
[Table] Remove length check when updating visible rows
This commit is contained in:
@ -165,17 +165,8 @@ define(
|
|||||||
|
|
||||||
//No need to scroll
|
//No need to scroll
|
||||||
if (this.$scope.displayRows.length < this.maxDisplayRows) {
|
if (this.$scope.displayRows.length < this.maxDisplayRows) {
|
||||||
//Check whether need to resynchronize visible with display
|
start = 0;
|
||||||
// rows (if data added)
|
end = this.$scope.displayRows.length;
|
||||||
if (this.$scope.visibleRows.length !==
|
|
||||||
this.$scope.displayRows.length){
|
|
||||||
start = 0;
|
|
||||||
end = this.$scope.displayRows.length;
|
|
||||||
} else {
|
|
||||||
//Data is in sync, and no need to calculate scroll,
|
|
||||||
// so do nothing.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
//rows has exceeded display maximum, so may be necessary to
|
//rows has exceeded display maximum, so may be necessary to
|
||||||
// scroll
|
// scroll
|
||||||
|
@ -61,13 +61,18 @@ define(
|
|||||||
]);
|
]);
|
||||||
mockElement.find.andReturn(mockElement);
|
mockElement.find.andReturn(mockElement);
|
||||||
mockElement.prop.andReturn(0);
|
mockElement.prop.andReturn(0);
|
||||||
|
mockElement[0] = {
|
||||||
|
scrollTop: 0,
|
||||||
|
scrollHeight: 500,
|
||||||
|
offsetHeight: 1000
|
||||||
|
};
|
||||||
|
|
||||||
mockScope.displayHeaders = true;
|
mockScope.displayHeaders = true;
|
||||||
mockTimeout = jasmine.createSpy('$timeout');
|
mockTimeout = jasmine.createSpy('$timeout');
|
||||||
mockTimeout.andReturn(promise(undefined));
|
mockTimeout.andReturn(promise(undefined));
|
||||||
|
|
||||||
controller = new MCTTableController(mockScope, mockTimeout, mockElement);
|
controller = new MCTTableController(mockScope, mockTimeout, mockElement);
|
||||||
spyOn(controller, 'setVisibleRows');
|
spyOn(controller, 'setVisibleRows').andCallThrough();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Reacts to changes to filters, headers, and rows', function() {
|
it('Reacts to changes to filters, headers, and rows', function() {
|
||||||
@ -178,6 +183,16 @@ define(
|
|||||||
expect(sortedRows[2].col2.text).toEqual('abc');
|
expect(sortedRows[2].col2.text).toEqual('abc');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// https://github.com/nasa/openmct/issues/910
|
||||||
|
it('updates visible rows in scope', function () {
|
||||||
|
var oldRows;
|
||||||
|
mockScope.rows = testRows;
|
||||||
|
controller.setRows(testRows);
|
||||||
|
oldRows = mockScope.visibleRows;
|
||||||
|
mockScope.toggleSort('col2');
|
||||||
|
expect(mockScope.visibleRows).not.toEqual(oldRows);
|
||||||
|
});
|
||||||
|
|
||||||
it('correctly sorts rows of differing types', function () {
|
it('correctly sorts rows of differing types', function () {
|
||||||
mockScope.sortColumn = 'col2';
|
mockScope.sortColumn = 'col2';
|
||||||
mockScope.sortDirection = 'desc';
|
mockScope.sortDirection = 'desc';
|
||||||
|
Reference in New Issue
Block a user