|
1 | | -import { ClientFunction } from 'testcafe'; |
2 | | -import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; |
3 | 1 | import DataGrid from 'devextreme-testcafe-models/dataGrid'; |
4 | | -import { createWidget } from '../../../helpers/createWidget'; |
5 | | -import url from '../../../helpers/getPageUrl'; |
6 | | -import { makeRowsViewTemplatesAsync } from '../helpers/asyncTemplates'; |
7 | | -import { testScreenshot } from '../../../helpers/themeUtils'; |
8 | | - |
9 | | -const DATA_GRID_SELECTOR = '#container'; |
| 2 | +import { createWidget } from '../../../../helpers/createWidget'; |
| 3 | +import url from '../../../../helpers/getPageUrl'; |
10 | 4 |
|
11 | 5 | fixture.disablePageReloads`FixedColumns` |
12 | | - .page(url(__dirname, '../../container.html')); |
| 6 | + .page(url(__dirname, '../../../container.html')); |
13 | 7 |
|
14 | 8 | // T1156153 |
15 | 9 | test('Fixed columns should have same width as not fixed columns with columnAutoWidth: true', async (t) => { |
@@ -137,250 +131,6 @@ test('Fixed columns should have same width as not fixed columns with columnAutoW |
137 | 131 | ); |
138 | 132 | }); |
139 | 133 |
|
140 | | -// T1148937 |
141 | | -test('Hovering over a row should work correctly when there is a fixed column and a column with a cellTemplate (React)', async (t) => { |
142 | | - // arrange |
143 | | - const dataGrid = new DataGrid('#container'); |
144 | | - const firstDataRow = dataGrid.getDataRow(0); |
145 | | - const firstFixedDataRow = dataGrid.getFixedDataRow(0); |
146 | | - const secondDataRow = dataGrid.getDataRow(1); |
147 | | - const secondFixedDataRow = dataGrid.getFixedDataRow(1); |
148 | | - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); |
149 | | - |
150 | | - // act |
151 | | - await t.hover(firstDataRow.element); |
152 | | - |
153 | | - // assert |
154 | | - await testScreenshot(t, takeScreenshot, 'T1148937-grid-hover-row-1.png', { element: dataGrid.element }); |
155 | | - |
156 | | - await t |
157 | | - .expect(firstDataRow.isHovered) |
158 | | - .ok() |
159 | | - .expect(firstFixedDataRow.isHovered) |
160 | | - .ok(); |
161 | | - |
162 | | - // act |
163 | | - await t.hover(secondFixedDataRow.element); |
164 | | - |
165 | | - // assert |
166 | | - await testScreenshot(t, takeScreenshot, 'T1148937-grid-hover-row-2.png', { element: dataGrid.element }); |
167 | | - |
168 | | - await t |
169 | | - .expect(secondDataRow.isHovered) |
170 | | - .ok() |
171 | | - .expect(secondFixedDataRow.isHovered) |
172 | | - .ok() |
173 | | - .expect(compareResults.isValid()) |
174 | | - .ok(compareResults.errorMessages()); |
175 | | -}).before(async (t) => { |
176 | | - await createWidget('dxDataGrid', { |
177 | | - dataSource: [...new Array(2)].map((_, index) => ({ id: index, text: `item ${index}` })), |
178 | | - keyExpr: 'id', |
179 | | - renderAsync: false, |
180 | | - hoverStateEnabled: true, |
181 | | - templatesRenderAsynchronously: true, |
182 | | - columns: [ |
183 | | - { dataField: 'id', fixed: true }, |
184 | | - { dataField: 'text', cellTemplate: '#test' }, |
185 | | - ], |
186 | | - columnFixing: { |
187 | | - // @ts-expect-error private option |
188 | | - legacyMode: true, |
189 | | - }, |
190 | | - showBorders: true, |
191 | | - }); |
192 | | - |
193 | | - await t.wait(100); |
194 | | - |
195 | | - // simulating async rendering in React |
196 | | - await ClientFunction(() => { |
197 | | - const dataGrid = ($('#container') as any).dxDataGrid('instance'); |
198 | | - |
199 | | - // eslint-disable-next-line no-underscore-dangle |
200 | | - dataGrid.getView('rowsView')._templatesCache = {}; |
201 | | - |
202 | | - // eslint-disable-next-line no-underscore-dangle |
203 | | - dataGrid._getTemplate = () => ({ |
204 | | - render(options) { |
205 | | - setTimeout(() => { |
206 | | - ($(options.container) as any).append(($('<div/>') as any).text(options.model.value)); |
207 | | - options.deferred?.resolve(); |
208 | | - }, 100); |
209 | | - }, |
210 | | - }); |
211 | | - |
212 | | - dataGrid.repaint(); |
213 | | - })(); |
214 | | - |
215 | | - await t.wait(200); |
216 | | -}); |
217 | | - |
218 | | -// T1177143 |
219 | | -test.meta({ browserSize: [800, 800] })('Fixed to the right columns should appear when any column has undefined or 0 width', async (t) => { |
220 | | - const dataGrid = new DataGrid('#container'); |
221 | | - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); |
222 | | - |
223 | | - await t.expect(dataGrid.isReady()).ok(); |
224 | | - |
225 | | - // act |
226 | | - await testScreenshot(t, takeScreenshot, 'T1177143-right-fixed-column-with-no-width-columns-1.png', { element: dataGrid.element }); |
227 | | - |
228 | | - await dataGrid.scrollTo(t, { x: 5000 }); |
229 | | - |
230 | | - await testScreenshot(t, takeScreenshot, 'T1177143-right-fixed-column-with-no-width-columns-2.png', { element: dataGrid.element }); |
231 | | - |
232 | | - await t |
233 | | - .expect(compareResults.isValid()) |
234 | | - .ok(compareResults.errorMessages()); |
235 | | -}).before(async () => createWidget('dxDataGrid', { |
236 | | - columnAutoWidth: false, |
237 | | - dataSource: [{ |
238 | | - Column1: 'a', |
239 | | - Column2: 'b', |
240 | | - Column3: 'b', |
241 | | - Column4: 'c', |
242 | | - Column5: 'd', |
243 | | - Column6: 'e', |
244 | | - Column7: 'f', |
245 | | - Column8: 'g', |
246 | | - }], |
247 | | - columnFixing: { |
248 | | - // @ts-expect-error private option |
249 | | - legacyMode: true, |
250 | | - }, |
251 | | - columns: [ |
252 | | - { |
253 | | - dataField: 'Column1', fixed: true, fixedPosition: 'right', width: 100, |
254 | | - }, |
255 | | - { dataField: 'Column2', width: undefined }, |
256 | | - { dataField: 'Column3', width: 0 }, |
257 | | - { dataField: 'Column4', width: 220 }, |
258 | | - { dataField: 'Column5', width: 240 }, |
259 | | - { dataField: 'Column6', width: 240 }, |
260 | | - { dataField: 'Column7', width: 0 }, |
261 | | - { dataField: 'Column8', width: 270 }, |
262 | | - ], |
263 | | -})); |
264 | | - |
265 | | -// T1180834 |
266 | | -test('Hovering over a row should work correctly after scrolling when there is a fixed column with a cellTemplate and virtual scrolling is used (React)', async (t) => { |
267 | | - // arrange |
268 | | - const dataGrid = new DataGrid('#container'); |
269 | | - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); |
270 | | - let dataRow = dataGrid.getDataRow(1); |
271 | | - let fixedDataRow = dataGrid.getDataRow(1); |
272 | | - |
273 | | - // assert |
274 | | - await t |
275 | | - .expect(dataGrid.isReady()) |
276 | | - .ok(); |
277 | | - |
278 | | - // act |
279 | | - await t.hover(dataRow.element); |
280 | | - |
281 | | - // assert |
282 | | - await testScreenshot(t, takeScreenshot, 'T1180834-grid-hover-row-after-scrolling-1.png', { element: dataGrid.element }); |
283 | | - |
284 | | - await t |
285 | | - .expect(dataRow.isHovered) |
286 | | - .ok() |
287 | | - .expect(fixedDataRow.isHovered) |
288 | | - .ok(); |
289 | | - |
290 | | - // act |
291 | | - await dataGrid.scrollTo(t, { y: 300 }); |
292 | | - dataRow = dataGrid.getDataRow(10); |
293 | | - await t.hover(dataRow.element); |
294 | | - |
295 | | - // assert |
296 | | - fixedDataRow = dataGrid.getDataRow(10); |
297 | | - |
298 | | - await testScreenshot(t, takeScreenshot, 'T1180834-grid-hover-row-after-scrolling-2.png', { element: dataGrid.element }); |
299 | | - |
300 | | - await t |
301 | | - .expect(dataRow.isHovered) |
302 | | - .ok() |
303 | | - .expect(fixedDataRow.isHovered) |
304 | | - .ok() |
305 | | - .expect(compareResults.isValid()) |
306 | | - .ok(compareResults.errorMessages()); |
307 | | -}).before(async () => { |
308 | | - await createWidget('dxDataGrid', { |
309 | | - dataSource: [...new Array(60)].map((_, index) => ({ id: index, text1: `item1 ${index}`, text2: `item2 ${index}` })), |
310 | | - height: 500, |
311 | | - keyExpr: 'id', |
312 | | - renderAsync: false, |
313 | | - hoverStateEnabled: true, |
314 | | - templatesRenderAsynchronously: true, |
315 | | - columns: [ |
316 | | - 'id', |
317 | | - { |
318 | | - dataField: 'text1', |
319 | | - cellTemplate: (_, { value }) => ($('<div/>') as any).text(value), |
320 | | - fixed: true, |
321 | | - }, |
322 | | - 'text2', |
323 | | - ], |
324 | | - columnFixing: { |
325 | | - // @ts-expect-error private option |
326 | | - legacyMode: true, |
327 | | - }, |
328 | | - paging: { |
329 | | - enabled: false, |
330 | | - }, |
331 | | - scrolling: { |
332 | | - useNative: false, |
333 | | - showScrollbar: 'never', |
334 | | - rowRenderingMode: 'virtual', |
335 | | - }, |
336 | | - showBorders: true, |
337 | | - }); |
338 | | - |
339 | | - await makeRowsViewTemplatesAsync(DATA_GRID_SELECTOR, 100); |
340 | | -}); |
341 | | - |
342 | | -// T1193153 |
343 | | -test.meta({ browserSize: [800, 800] })('The grid layout should be correct after resizing the window when there are fixed and band columns', async (t) => { |
344 | | - // arrange |
345 | | - const dataGrid = new DataGrid('#container'); |
346 | | - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); |
347 | | - |
348 | | - // assert |
349 | | - await t |
350 | | - .expect(dataGrid.isReady()) |
351 | | - .ok(); |
352 | | - |
353 | | - // act |
354 | | - await testScreenshot(t, takeScreenshot, 'T1193153-layout-with-fixed-and-band-columns-1.png', { element: dataGrid.element }); |
355 | | - await t.resizeWindow(400, 400); |
356 | | - await testScreenshot(t, takeScreenshot, 'T1193153-layout-with-fixed-and-band-columns-2.png', { element: dataGrid.element }); |
357 | | - |
358 | | - // assert |
359 | | - await t |
360 | | - .expect(compareResults.isValid()) |
361 | | - .ok(compareResults.errorMessages()); |
362 | | -}).before(async () => createWidget('dxDataGrid', { |
363 | | - columnAutoWidth: true, |
364 | | - dataSource: [{}], |
365 | | - columnFixing: { |
366 | | - // @ts-expect-error private option |
367 | | - legacyMode: true, |
368 | | - }, |
369 | | - columns: [{ |
370 | | - caption: 'Fixed column', |
371 | | - fixed: true, |
372 | | - columns: [{ |
373 | | - caption: 'Banded column', |
374 | | - width: 150, |
375 | | - }], |
376 | | - }, { |
377 | | - caption: 'Default column', |
378 | | - }, { |
379 | | - type: 'buttons', |
380 | | - width: 50, |
381 | | - }], |
382 | | -})); |
383 | | - |
384 | 134 | test('DataGrid - Group summary is not updated when a column is fixed on the right side (T1223764)', async (t) => { |
385 | 135 | const dataGrid = new DataGrid('#container'); |
386 | 136 | const editCell = dataGrid.getDataRow(1).getDataCell(2); |
|
0 commit comments