Skip to content

Commit

Permalink
TreeList - Select All should work correctly when virtual scrolling is…
Browse files Browse the repository at this point in the history
… enabled - T1189118 (#25700)
  • Loading branch information
Tucchhaa authored Sep 28, 2023
1 parent d8051df commit 9ecb391
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const DataController = (dataControllerModule.controllers as any).data.inh
},

_isItemEquals(item1, item2) {
if (!this.callBase.apply(this, arguments)) {
if (item1.isSelected !== item2.isSelected) {
return false;
}

Expand All @@ -51,7 +51,18 @@ export const DataController = (dataControllerModule.controllers as any).data.inh
return false;
}

return true;
return this.callBase.apply(this, arguments);
},

// eslint-disable-next-line @typescript-eslint/no-unused-vars
_isCellChanged(oldRow, newRow, visibleRowIndex, columnIndex, isLiveUpdate) {
const firstDataColumnIndex = this._columnsController.getFirstDataColumnIndex();

if (columnIndex === firstDataColumnIndex && oldRow.isSelected !== newRow.isSelected) {
return true;
}

return this.callBase.apply(this, arguments);
},

init() {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions packages/devextreme/testing/testcafe/tests/treeList/scrolling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import url from '../../helpers/getPageUrl';
import createWidget from '../../helpers/createWidget';
import { safeSizeTest } from '../../helpers/safeSizeTest';
import TreeList from '../../model/treeList';
import CheckBox from '../../model/checkBox';

const scrollWindowTo = async (position: object) => {
await ClientFunction(
Expand Down Expand Up @@ -119,3 +120,59 @@ safeSizeTest('The vertical scroll bar of the container\'s parent should not be d
$('#container').unwrap();
})();
});

// T1189118
safeSizeTest('All items should be selected after select all and scroll down', async (t) => {
// arrange
const treeList = new TreeList('#container');
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);

// assert
await t
.expect(treeList.isReady())
.ok();

// act
const selectAllCheckBox = new CheckBox(
treeList.getHeaders().getHeaderRow(0).getHeaderCell(0).getEditor().element,
);

await t.click(selectAllCheckBox.element);

// assert
await t
.expect(await takeScreenshot('T1189118-treelist-select-all-with-virtual-scrolling-1'))
.ok();

// act
await treeList.scrollTo(t, { y: 300 });

// assert
await t
.expect(await takeScreenshot('T1189118-treelist-select-all-with-virtual-scrolling-2'))
.ok();

await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}, [800, 800]).before(async () => createWidget('dxTreeList', {
dataSource: generateData(100),
height: 400,
rootValue: -1,
columnMinWidth: 80,
columnAutoWidth: true,
allowColumnResizing: true,
keyExpr: 'ID',
parentIdExpr: 'Head_ID',
showRowLines: true,
showBorders: true,
autoExpandAll: true,
scrolling: {
mode: 'virtual',
},
selection: {
allowSelectAll: true,
mode: 'multiple',
},
columns: ['Title', 'Full_Name', 'City'],
}));

0 comments on commit 9ecb391

Please sign in to comment.