@@ -6,7 +6,11 @@ import url from '../../../../helpers/getPageUrl';
66fixture . disablePageReloads `Grouping Panel - check borders and backgrounds with various options`
77 . page ( url ( __dirname , '../../../container.html' ) ) ;
88
9- const GRID_SELECTOR = '#container' ;
9+ const SELECTORS = {
10+ gridContainer : 'container' ,
11+ masterDetailClass : 'dx-master-detail-row' ,
12+ groupRowClass : 'dx-group-row' ,
13+ } ;
1014
1115const FORBIDDEN_COLORS = [ 'transparent' , 'white' , 'black' , 'rgb(0, 0, 0)' , 'rgb(255, 255, 255)' ] ;
1216
@@ -172,20 +176,37 @@ const verifyGridStyles = async (t, dataGrid, matrixOptions) => {
172176 }
173177
174178 if ( matrixOptions . rowAlternationEnabled ) {
175- const rows = dataGrid . getRows ( ) ;
176- for ( let i = 1 ; i < rows . length ; i += 1 ) {
177- const currentRow = rows . nth ( i ) ;
178- const previousRow = rows . nth ( i - 1 ) ;
179+ const filteredRows = dataGrid . getRows ( ) . find ( `tr:not(.${ SELECTORS . masterDetailClass } )` ) ;
180+ const filteredRowsLength = await filteredRows . count ;
181+
182+ let i = 1 ;
183+ while ( i < filteredRowsLength ) {
184+ const currentRow = filteredRows . nth ( i ) ;
185+ const previousRow = filteredRows . nth ( i - 1 ) ;
179186
180187 const currentClasses = await currentRow . getAttribute ( 'class' ) ;
181188 const previousClasses = await previousRow . getAttribute ( 'class' ) ;
182189
183- if ( currentClasses === previousClasses ) {
190+ if ( currentClasses ?. includes ( SELECTORS . groupRowClass ) ) {
191+ i += 2 ;
192+ // eslint-disable-next-line no-continue
193+ continue ;
194+ }
195+
196+ if ( previousClasses ?. includes ( SELECTORS . groupRowClass ) ) {
197+ i += 1 ;
198+ // eslint-disable-next-line no-continue
199+ continue ;
200+ }
201+
202+ if ( currentClasses !== previousClasses ) {
184203 const currentBg = await currentRow . getStyleProperty ( 'background-color' ) ;
185204 const previousBg = await previousRow . getStyleProperty ( 'background-color' ) ;
186205
187206 await t . expect ( currentBg ) . notEql ( previousBg ) ;
188207 }
208+
209+ i += 1 ;
189210 }
190211 }
191212
@@ -213,7 +234,7 @@ const verifyGridStyles = async (t, dataGrid, matrixOptions) => {
213234 }
214235
215236 if ( matrixOptions . showColumnLines ) {
216- const cells = dataGrid . getCells ( ) ;
237+ const cells = dataGrid . getCells ( ) . find ( 'td:not([class])' ) ;
217238 const cellsCount = await cells . count ;
218239
219240 for ( let i = 0 ; i < cellsCount ; i += 1 ) {
@@ -230,7 +251,7 @@ const verifyGridStyles = async (t, dataGrid, matrixOptions) => {
230251
231252const functionalTest = ( matrixOptions ) => {
232253 test ( `Should have correct applied styles with ${ getTestParams ( matrixOptions ) } ` , async ( t ) => {
233- const dataGrid = new DataGrid ( GRID_SELECTOR ) ;
254+ const dataGrid = new DataGrid ( `# ${ SELECTORS . gridContainer } ` ) ;
234255 await dataGrid . isReady ( ) ;
235256
236257 await verifyGridStyles ( t , dataGrid , matrixOptions ) ;
@@ -249,8 +270,6 @@ const functionalTest = (matrixOptions) => {
249270 } ) ;
250271} ;
251272
252- // visual: generic.light
253- // visual: material.blue.light
254273[ true , false ] . forEach ( ( hasFixedColumn ) => {
255274 [ true , false ] . forEach ( ( hasMasterDetail ) => {
256275 [ true , false ] . forEach ( ( rowAlternationEnabled ) => {
0 commit comments