|
| 1 | +import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; |
| 2 | +import DataGrid from 'devextreme-testcafe-models/dataGrid'; |
| 3 | + |
| 4 | +import url from '../../helpers/getPageUrl'; |
| 5 | +import { createWidget } from '../../helpers/createWidget'; |
| 6 | + |
| 7 | +fixture`Column resizing` |
| 8 | + .page(url(__dirname, '../container.html')); |
| 9 | + |
| 10 | +test('column separator should starts from the parent', async (t) => { |
| 11 | + const { takeScreenshot, compareResults } = createScreenshotsComparer(t); |
| 12 | + const dataGrid = new DataGrid('#container'); |
| 13 | + async function makeColumnSeparatorScreenshot(index: number) { |
| 14 | + await dataGrid.resizeHeader(index, 0, false); |
| 15 | + await t.expect(await takeScreenshot(`column-separator-${index}.png`)).ok(); |
| 16 | + await t.dispatchEvent(dataGrid.element, 'mouseup'); |
| 17 | + } |
| 18 | + |
| 19 | + await makeColumnSeparatorScreenshot(1); |
| 20 | + await makeColumnSeparatorScreenshot(2); |
| 21 | + await makeColumnSeparatorScreenshot(3); |
| 22 | + await makeColumnSeparatorScreenshot(4); |
| 23 | + await makeColumnSeparatorScreenshot(5); |
| 24 | + await makeColumnSeparatorScreenshot(6); |
| 25 | + await makeColumnSeparatorScreenshot(7); |
| 26 | + await makeColumnSeparatorScreenshot(8); |
| 27 | + await makeColumnSeparatorScreenshot(9); |
| 28 | + |
| 29 | + await t |
| 30 | + .expect(compareResults.isValid()) |
| 31 | + .ok(compareResults.errorMessages()); |
| 32 | +}).before(async () => createWidget('dxDataGrid', { |
| 33 | + dataSource: [{ |
| 34 | + ID: 1, |
| 35 | + Country: 'Brazil', |
| 36 | + Area: 8515767, |
| 37 | + Population_Urban: 0.85, |
| 38 | + Population_Rural: 0.15, |
| 39 | + Population_Total: 205809000, |
| 40 | + GDP_Agriculture: 0.054, |
| 41 | + GDP_Industry: 0.274, |
| 42 | + GDP_Services: 0.672, |
| 43 | + GDP_Total: 2353025, |
| 44 | + }], |
| 45 | + keyExpr: 'ID', |
| 46 | + columnWidth: 100, |
| 47 | + allowColumnResizing: true, |
| 48 | + showBorders: true, |
| 49 | + editing: { |
| 50 | + allowUpdating: true, |
| 51 | + }, |
| 52 | + columns: ['Country', { |
| 53 | + dataField: 'Population_Total', |
| 54 | + visible: false, |
| 55 | + }, { |
| 56 | + caption: 'Population', |
| 57 | + columns: ['Population_Rural', { |
| 58 | + caption: 'By Sector', |
| 59 | + columns: ['GDP_Total', { |
| 60 | + caption: 'not resizable', |
| 61 | + dataField: 'ID', |
| 62 | + allowResizing: false, |
| 63 | + }, 'GDP_Agriculture', 'GDP_Industry'], |
| 64 | + }], |
| 65 | + }, { |
| 66 | + caption: 'Nominal GDP', |
| 67 | + columns: ['GDP_Total', 'Population_Urban'], |
| 68 | + }, 'Area'], |
| 69 | +})); |
0 commit comments