@@ -2,6 +2,7 @@ import { ClientFunction, Selector } from 'testcafe';
22import { createScreenshotsComparer } from 'devextreme-screenshot-comparer' ;
33import DataGrid from 'devextreme-testcafe-models/dataGrid' ;
44import { ClassNames } from 'devextreme-testcafe-models/dataGrid/classNames' ;
5+ import type { DataGridScrollMode } from 'devextreme/ui/data_grid' ;
56import { insertStylesheetRulesToPage } from '../../../helpers/domUtils' ;
67import url from '../../../helpers/getPageUrl' ;
78import { createWidget } from '../../../helpers/createWidget' ;
@@ -921,6 +922,8 @@ test.meta({ browserSize: [800, 700] })('New mode. Rows should be rendered proper
921922test . meta ( { browserSize : [ 800 , 800 ] } ) ( 'Rows are rendered properly when window content is scrolled (T1070388)' , async ( t ) => {
922923 const dataGrid = new DataGrid ( '#container' ) ;
923924
925+ await t . expect ( dataGrid . isReady ( ) ) . ok ( ) ;
926+
924927 const scrollWindowTo = async ( position : number ) => {
925928 await ClientFunction (
926929 ( ) => {
@@ -1413,7 +1416,7 @@ test.meta({ runInTheme: Themes.genericLight })('New virtual mode. Navigation to
14131416 . notOk ( ) ;
14141417
14151418 for ( let i = 0 ; i < 3 ; i += 1 ) {
1416- // act
1419+ // act
14171420 await t
14181421 . click ( dataGrid . getPager ( ) . getNavPage ( '4' ) . element )
14191422 . wait ( 3500 ) ;
@@ -1542,72 +1545,71 @@ test('Last group should not disappear after collapsing another subgroup with vir
15421545} ) ) ;
15431546
15441547// T1152498
1545- // ['infinite', 'virtual'].forEach((scrollingMode) => {
1546- // eslint-disable-next-line max-len
1547- // test.meta({ browserSize: [900, 600] })(`${scrollingMode} scrolling - the markup should be correct for continuous scrolling when there is a fixed column with cellTemplate (React)`, async (t) => {
1548- // // arrange
1549- // const dataGrid = new DataGrid('#container');
1550- // const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
1551- //
1552- // // act
1553- // await dataGrid.scrollTo(t, { y: 200 });
1554- // await t.wait(100);
1555- // await dataGrid.scrollTo(t, { y: 400 });
1556- // await t.wait(300);
1557- //
1558- // // assert
1559- // await t
1560- // .expect(await takeScreenshot(`grid-${scrollingMode}-scrolling-T1152498.png`, '#container'))
1561- // .ok()
1562- // .expect(compareResults.isValid())
1563- // .ok(compareResults.errorMessages());
1564- // }).before(async (t) => {
1565- // await createWidget('dxDataGrid', {
1566- // dataSource: [...new Array(500)].map((_, index) => ({ id: index, text: `item ${index}` })),
1567- // keyExpr: 'id',
1568- // height: 440,
1569- // width: 800,
1570- // renderAsync: false,
1571- // templatesRenderAsynchronously: true,
1572- // columnFixing: {
1573- // // @ts -expect-error private option
1574- // legacyMode: true,
1575- // },
1576- // customizeColumns(columns) {
1577- // columns[0].width = 70;
1578- // columns[0].fixed = true;
1579- // columns[0].cellTemplate = '#test';
1580- // },
1581- // scrolling: {
1582- // mode: scrollingMode,
1583- // },
1584- // });
1585- //
1586- // await t.wait(100);
1587- //
1588- // // simulating async rendering in React
1589- // await ClientFunction(() => {
1590- // const dataGrid = ($('#container') as any).dxDataGrid('instance');
1591- //
1592- // // eslint-disable-next-line no-underscore-dangle
1593- // dataGrid.getView('rowsView')._templatesCache = {};
1594- //
1595- // // eslint-disable-next-line no-underscore-dangle
1596- // dataGrid._getTemplate = () => ({
1597- // render(options) {
1598- // setTimeout(() => {
1599- // ($(options.container) as any).append(($('<div/>') as any).text(options.model.value));
1600- // options.deferred?.resolve();
1601- // }, 200);
1602- // },
1603- // });
1604- //
1605- // dataGrid.repaint();
1606- // })();
1607- //
1608- // await t.wait(300);
1609- // });
1610- // });
1548+ [ 'infinite' , 'virtual' ] . forEach ( ( scrollingMode : DataGridScrollMode ) => {
1549+ test ( `${ scrollingMode } scrolling - the markup should be correct for continuous scrolling when there is a fixed column with cellTemplate (React)` , async ( t ) => {
1550+ // arrange
1551+ const dataGrid = new DataGrid ( '#container' ) ;
1552+ const { takeScreenshot, compareResults } = createScreenshotsComparer ( t ) ;
1553+
1554+ await t . expect ( dataGrid . isReady ( ) ) . ok ( ) ;
1555+
1556+ // act
1557+ await dataGrid . scrollTo ( t , { y : 200 } ) ;
1558+ await dataGrid . scrollTo ( t , { y : 600 } ) ;
1559+ await t . expect ( dataGrid . isReady ( ) ) . ok ( ) ;
1560+
1561+ // assert
1562+ await testScreenshot ( t , takeScreenshot , `grid-${ scrollingMode } -scrolling-T1152498.png` , { element : '#container' } ) ;
1563+
1564+ await t
1565+ . expect ( compareResults . isValid ( ) )
1566+ . ok ( compareResults . errorMessages ( ) ) ;
1567+ } ) . before ( async ( t ) => {
1568+ await createWidget ( 'dxDataGrid' , {
1569+ dataSource : [ ...new Array ( 500 ) ] . map ( ( _ , index ) => ( { id : index , text : `item ${ index } ` } ) ) ,
1570+ keyExpr : 'id' ,
1571+ height : 440 ,
1572+ width : 800 ,
1573+ renderAsync : false ,
1574+ templatesRenderAsynchronously : true ,
1575+ columnFixing : {
1576+ // @ts -expect-error private option
1577+ legacyMode : true ,
1578+ } ,
1579+ customizeColumns ( columns ) {
1580+ columns [ 0 ] . width = 70 ;
1581+ columns [ 0 ] . fixed = true ;
1582+ columns [ 0 ] . cellTemplate = '#test' ;
1583+ } ,
1584+ scrolling : {
1585+ mode : scrollingMode ,
1586+ } ,
1587+ } ) ;
1588+
1589+ const dataGrid = new DataGrid ( '#container' ) ;
1590+ await t . expect ( dataGrid . isReady ( ) ) . ok ( ) ;
1591+
1592+ // simulating async rendering in React
1593+ await ClientFunction ( ( ) => {
1594+ const dataGridInstance = ( $ ( '#container' ) as any ) . dxDataGrid ( 'instance' ) ;
1595+
1596+ // eslint-disable-next-line no-underscore-dangle
1597+ dataGridInstance . getView ( 'rowsView' ) . _templatesCache = { } ;
1598+
1599+ // eslint-disable-next-line no-underscore-dangle
1600+ dataGridInstance . _getTemplate = ( ) => ( {
1601+ render ( options ) {
1602+ setTimeout ( ( ) => {
1603+ ( $ ( options . container ) as any ) . append ( ( $ ( '<div/>' ) as any ) . text ( options . model . value ) ) ;
1604+ options . deferred ?. resolve ( ) ;
1605+ } , 1000 ) ;
1606+ } ,
1607+ } ) ;
1608+
1609+ dataGridInstance . repaint ( ) ;
1610+ } ) ( ) ;
1611+ } ) ;
1612+ } ) ;
16111613
16121614test ( 'Editors should keep changes after being scrolled out of sight (T1145698)' , async ( t ) => {
16131615 const dataGrid = new DataGrid ( '#container' ) ;
0 commit comments