forked from DevExpress/DevExtreme
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DataGrid(T1162057): Datagrid - Grouping & Pagination - Shows "Continu…
…es on the next page" even when there are no records left in a group (DevExpress#24464) Co-authored-by: Ilya Vinogradov <ilya.vinogradov@devexpress.com>
- Loading branch information
1 parent
d02af17
commit f890aff
Showing
12 changed files
with
241 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
233 changes: 233 additions & 0 deletions
233
testing/testcafe/tests/dataGrid/grouping/T1162057_oneGroupOnDifferentPages.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,233 @@ | ||
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; | ||
import { RequestMock } from 'testcafe'; | ||
import createWidget from '../../../helpers/createWidget'; | ||
import url from '../../../helpers/getPageUrl'; | ||
import DataGrid from '../../../model/dataGrid'; | ||
|
||
fixture`Grouping Panel - One group on different pages` | ||
.page(url(__dirname, '../../containerAspNet.html')); | ||
|
||
const GRID_SELECTOR = '#container'; | ||
|
||
const endsOnNextPageApiMock = RequestMock() | ||
.onRequestTo(/\/api\/data\?skip=0&take=5/) | ||
.respond( | ||
{ | ||
data: [ | ||
{ key: 'KeyA', items: null, count: 6 }, | ||
{ key: 'KeyB', items: null, count: 3 }, | ||
], | ||
groupCount: 2, | ||
totalCount: 11, | ||
}, | ||
200, | ||
{ 'access-control-allow-origin': '*' }, | ||
) | ||
.onRequestTo(/\/api\/data\?skip=0&take=1/) | ||
.respond( | ||
{ | ||
data: [ | ||
{ key: 'KeyA', items: null, count: 6 }, | ||
], | ||
groupCount: 2, | ||
totalCount: 11, | ||
}, | ||
200, | ||
{ 'access-control-allow-origin': '*' }, | ||
) | ||
.onRequestTo(/\/api\/data\?skip=0&take=3/) | ||
.respond( | ||
{ | ||
data: [ | ||
{ key: 'KeyA', items: null, count: 6 }, | ||
{ key: 'KeyB', items: null, count: 3 }, | ||
], | ||
groupCount: 2, | ||
totalCount: 11, | ||
}, | ||
200, | ||
{ 'access-control-allow-origin': '*' }, | ||
) | ||
.onRequestTo(/\/api\/data\?take=4.*&filter=.*KeyA/) | ||
.respond( | ||
{ | ||
data: [ | ||
{ id: 0, data: 'A' }, | ||
{ id: 1, data: 'B' }, | ||
{ id: 2, data: 'C' }, | ||
{ id: 3, data: 'D' }, | ||
], | ||
}, | ||
200, | ||
{ 'access-control-allow-origin': '*' }, | ||
) | ||
.onRequestTo(/\/api\/data\?skip=4.*&filter=.*KeyA/) | ||
.respond( | ||
{ | ||
data: [ | ||
{ id: 4, data: 'E' }, | ||
{ id: 5, data: 'F' }, | ||
], | ||
}, | ||
200, | ||
{ 'access-control-allow-origin': '*' }, | ||
); | ||
|
||
test('Group panel restored from cache and ends at the next page', async (t) => { | ||
const { takeScreenshot, compareResults } = createScreenshotsComparer(t); | ||
const dataGrid = new DataGrid(GRID_SELECTOR); | ||
|
||
await t.click(dataGrid.getGroupRow(0).getCell(0).element); | ||
await takeScreenshot('group-panel_loaded_first-page.png', dataGrid.element); | ||
|
||
await t.click(dataGrid.getPager().getNavPage('2').element); | ||
await takeScreenshot('group-panel_loaded_second-page.png', dataGrid.element); | ||
|
||
await t.click(dataGrid.getPager().getNavPage('1').element); | ||
await takeScreenshot('group-panel_restored_first-page.png', dataGrid.element); | ||
|
||
await t.click(dataGrid.getPager().getNavPage('2').element); | ||
await takeScreenshot('group-panel_restored_second-page.png', dataGrid.element); | ||
|
||
await t.expect(compareResults.isValid()) | ||
.ok(compareResults.errorMessages()); | ||
}).before(async (t) => { | ||
await t.addRequestHooks(endsOnNextPageApiMock); | ||
await createWidget('dxDataGrid', () => ({ | ||
dataSource: (window as any).DevExpress.data.AspNet.createStore({ | ||
key: 'id', | ||
loadUrl: 'https://api/data', | ||
}), | ||
columns: [ | ||
'data', | ||
{ | ||
dataField: 'key', | ||
groupIndex: 0, | ||
}, | ||
], | ||
groupPanel: { | ||
visible: true, | ||
}, | ||
grouping: { | ||
autoExpandAll: false, | ||
}, | ||
remoteOperations: { | ||
groupPaging: true, | ||
}, | ||
pager: { | ||
visible: true, | ||
showInfo: true, | ||
showPageSizeSelector: true, | ||
allowedPageSizes: [5], | ||
displayMode: 'full', | ||
}, | ||
paging: { | ||
pageSize: 5, | ||
}, | ||
})); | ||
}).after(async (t) => { | ||
await t.removeRequestHooks(endsOnNextPageApiMock); | ||
}); | ||
|
||
const endsOnPageApiMock = RequestMock() | ||
.onRequestTo(/\/api\/data\?skip=0&take=5/) | ||
.respond( | ||
{ | ||
data: [ | ||
{ key: 'KeyA', items: null, count: 4 }, | ||
{ key: 'KeyB', items: null, count: 2 }, | ||
], | ||
groupCount: 2, | ||
totalCount: 8, | ||
}, | ||
200, | ||
{ 'access-control-allow-origin': '*' }, | ||
) | ||
.onRequestTo(/\/api\/data\?skip=0&take=1/) | ||
.respond( | ||
{ | ||
data: [ | ||
{ key: 'KeyA', items: null, count: 4 }, | ||
], | ||
groupCount: 2, | ||
totalCount: 8, | ||
}, | ||
200, | ||
{ 'access-control-allow-origin': '*' }, | ||
) | ||
.onRequestTo(/\/api\/data\?skip=1&take=5/) | ||
.respond( | ||
{ | ||
data: [ | ||
{ key: 'KeyB', items: null, count: 2 }, | ||
], | ||
groupCount: 2, | ||
totalCount: 8, | ||
}, | ||
200, | ||
{ 'access-control-allow-origin': '*' }, | ||
) | ||
.onRequestTo(/\/api\/data.*&filter=.*KeyA/) | ||
.respond( | ||
{ | ||
data: [ | ||
{ id: 0, data: 'A' }, | ||
{ id: 1, data: 'B' }, | ||
{ id: 2, data: 'C' }, | ||
{ id: 3, data: 'D' }, | ||
], | ||
}, | ||
200, | ||
{ 'access-control-allow-origin': '*' }, | ||
); | ||
|
||
test('Group panel restored from cache and ends at the page end', async (t) => { | ||
const { takeScreenshot, compareResults } = createScreenshotsComparer(t); | ||
const dataGrid = new DataGrid(GRID_SELECTOR); | ||
|
||
await t.click(dataGrid.getGroupRow(0).getCell(0).element); | ||
await takeScreenshot('group-panel_loaded_page-end.png', dataGrid.element); | ||
|
||
await t.click(dataGrid.getPager().getNavPage('2').element) | ||
.click(dataGrid.getPager().getNavPage('1').element); | ||
await takeScreenshot('group-panel_restored_page-end.png', dataGrid.element); | ||
|
||
await t.expect(compareResults.isValid()) | ||
.ok(compareResults.errorMessages()); | ||
}).before(async (t) => { | ||
await t.addRequestHooks(endsOnPageApiMock); | ||
await createWidget('dxDataGrid', () => ({ | ||
dataSource: (window as any).DevExpress.data.AspNet.createStore({ | ||
key: 'id', | ||
loadUrl: 'https://api/data', | ||
}), | ||
columns: [ | ||
'data', | ||
{ | ||
dataField: 'key', | ||
groupIndex: 0, | ||
}, | ||
], | ||
groupPanel: { | ||
visible: true, | ||
}, | ||
grouping: { | ||
autoExpandAll: false, | ||
}, | ||
remoteOperations: { | ||
groupPaging: true, | ||
}, | ||
pager: { | ||
visible: true, | ||
showInfo: true, | ||
showPageSizeSelector: true, | ||
allowedPageSizes: [5], | ||
displayMode: 'full', | ||
}, | ||
paging: { | ||
pageSize: 5, | ||
}, | ||
})); | ||
}).after(async (t) => { | ||
await t.removeRequestHooks(endsOnPageApiMock); | ||
}); |
File renamed without changes
Binary file added
BIN
+13.7 KB
testing/testcafe/tests/dataGrid/grouping/etalons/group-panel_loaded_first-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10 KB
testing/testcafe/tests/dataGrid/grouping/etalons/group-panel_loaded_page-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.2 KB
...ing/testcafe/tests/dataGrid/grouping/etalons/group-panel_loaded_second-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.7 KB
...ng/testcafe/tests/dataGrid/grouping/etalons/group-panel_restored_first-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10 KB
testing/testcafe/tests/dataGrid/grouping/etalons/group-panel_restored_page-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.2 KB
...g/testcafe/tests/dataGrid/grouping/etalons/group-panel_restored_second-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
8 changes: 4 additions & 4 deletions
8
testing/testcafe/tests/dataGrid/grouping.ts → ...tcafe/tests/dataGrid/grouping/grouping.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters