@@ -2,7 +2,6 @@ import { render } from "enzyme";
22import * as testingLibrary from "@testing-library/react" ;
33import { GUID , ObjectItem } from "mendix" ;
44import { createElement } from "react" ;
5- import { SelectionMethod } from "../../features/selection" ;
65import { Table , TableProps } from "../Table" ;
76import { objectItems } from "@mendix/pluggable-test-utils" ;
87import "@testing-library/jest-dom" ;
@@ -178,7 +177,7 @@ describe("Table", () => {
178177 const items = objectItems ( 3 ) ;
179178
180179 const { container } = render (
181- < Table { ...mockTableProps ( ) } data = { items } paging selectionMethod = { SelectionMethod . checkbox } />
180+ < Table { ...mockTableProps ( ) } data = { items } paging selectionMethod = { " checkbox" } />
182181 ) ;
183182
184183 expect ( container . firstChild ) . toHaveClass ( "widget-datagrid-selection-method-checkbox" ) ;
@@ -189,21 +188,15 @@ describe("Table", () => {
189188 const items = objectItems ( 3 ) ;
190189
191190 const { asFragment } = render (
192- < Table
193- { ...mockTableProps ( ) }
194- data = { items }
195- paging
196- selectionMethod = { SelectionMethod . checkbox }
197- isSelected = { ( ) => true }
198- />
191+ < Table { ...mockTableProps ( ) } data = { items } paging selectionMethod = { "checkbox" } isSelected = { ( ) => true } />
199192 ) ;
200193
201194 expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
202195 } ) ;
203196
204197 it ( "set negative tabindex on row checkbox" , ( ) => {
205198 const { getAllByRole } = testingLibrary . render (
206- < Table { ...mockTableProps ( ) } paging selectionMethod = { SelectionMethod . checkbox } />
199+ < Table { ...mockTableProps ( ) } paging selectionMethod = { " checkbox" } />
207200 ) ;
208201
209202 getAllByRole ( "checkbox" ) . forEach ( elt => {
@@ -215,7 +208,7 @@ describe("Table", () => {
215208 const items = objectItems ( 6 ) ;
216209 const [ a , b , c , d , e , f ] = items ;
217210 const { rerender } = testingLibrary . render (
218- < Table { ...mockTableProps ( ) } data = { items } paging selectionMethod = { SelectionMethod . checkbox } />
211+ < Table { ...mockTableProps ( ) } data = { items } paging selectionMethod = { " checkbox" } />
219212 ) ;
220213
221214 // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -229,7 +222,7 @@ describe("Table", () => {
229222 { ...mockTableProps ( ) }
230223 data = { items }
231224 paging
232- selectionMethod = { SelectionMethod . checkbox }
225+ selectionMethod = { " checkbox" }
233226 isSelected = { item => [ a , b , c ] . includes ( item ) }
234227 />
235228 ) ;
@@ -241,7 +234,7 @@ describe("Table", () => {
241234 { ...mockTableProps ( ) }
242235 data = { items }
243236 paging
244- selectionMethod = { SelectionMethod . checkbox }
237+ selectionMethod = { " checkbox" }
245238 isSelected = { item => [ c ] . includes ( item ) }
246239 />
247240 ) ;
@@ -253,7 +246,7 @@ describe("Table", () => {
253246 { ...mockTableProps ( ) }
254247 data = { items }
255248 paging
256- selectionMethod = { SelectionMethod . checkbox }
249+ selectionMethod = { " checkbox" }
257250 isSelected = { item => [ d , e ] . includes ( item ) }
258251 />
259252 ) ;
@@ -265,7 +258,7 @@ describe("Table", () => {
265258 { ...mockTableProps ( ) }
266259 data = { items }
267260 paging
268- selectionMethod = { SelectionMethod . checkbox }
261+ selectionMethod = { " checkbox" }
269262 isSelected = { item => [ f , e , d , a ] . includes ( item ) }
270263 />
271264 ) ;
@@ -279,13 +272,7 @@ describe("Table", () => {
279272 const onSelect = jest . fn ( ) ;
280273
281274 render (
282- < Table
283- { ...mockTableProps ( ) }
284- data = { items }
285- paging
286- selectionMethod = { SelectionMethod . checkbox }
287- onSelect = { onSelect }
288- />
275+ < Table { ...mockTableProps ( ) } data = { items } paging selectionMethod = { "checkbox" } onSelect = { onSelect } />
289276 ) ;
290277
291278 const checkbox1 = screen . getAllByRole ( "checkbox" ) [ 0 ] ;
@@ -317,7 +304,7 @@ describe("Table", () => {
317304 data = { items }
318305 paging
319306 selectionStatus = { undefined }
320- selectionMethod = { SelectionMethod . checkbox }
307+ selectionMethod = { " checkbox" }
321308 />
322309 ) ;
323310
@@ -335,7 +322,7 @@ describe("Table", () => {
335322 data = { items }
336323 paging
337324 selectionStatus = { status }
338- selectionMethod = { SelectionMethod . checkbox }
325+ selectionMethod = { " checkbox" }
339326 />
340327 ) ;
341328
@@ -360,7 +347,7 @@ describe("Table", () => {
360347 data = { items }
361348 paging
362349 selectionStatus = { "some" }
363- selectionMethod = { SelectionMethod . rowClick }
350+ selectionMethod = { " rowClick" }
364351 />
365352 ) ;
366353
@@ -379,7 +366,7 @@ describe("Table", () => {
379366 data = { items }
380367 paging
381368 selectionStatus = "none"
382- selectionMethod = { SelectionMethod . checkbox }
369+ selectionMethod = { " checkbox" }
383370 onSelectAll = { onSelectAll }
384371 />
385372 ) ;
@@ -400,7 +387,7 @@ describe("Table", () => {
400387 const items = objectItems ( 3 ) ;
401388
402389 const { container } = render (
403- < Table { ...mockTableProps ( ) } data = { items } paging selectionMethod = { SelectionMethod . rowClick } />
390+ < Table { ...mockTableProps ( ) } data = { items } paging selectionMethod = { " rowClick" } />
404391 ) ;
405392
406393 expect ( container . firstChild ) . toHaveClass ( "widget-datagrid-selection-method-click" ) ;
@@ -411,13 +398,7 @@ describe("Table", () => {
411398 const items = objectItems ( 3 ) ;
412399
413400 const { asFragment } = render (
414- < Table
415- { ...mockTableProps ( ) }
416- data = { items }
417- paging
418- selectionMethod = { SelectionMethod . rowClick }
419- isSelected = { ( ) => true }
420- />
401+ < Table { ...mockTableProps ( ) } data = { items } paging selectionMethod = { "rowClick" } isSelected = { ( ) => true } />
421402 ) ;
422403
423404 expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
@@ -442,7 +423,7 @@ describe("Table", () => {
442423 data = { items }
443424 cellRenderer = { ( renderWrapper , _ , columnIndex ) => renderWrapper ( columns [ columnIndex ] . header ) }
444425 paging
445- selectionMethod = { SelectionMethod . rowClick }
426+ selectionMethod = { " rowClick" }
446427 onSelect = { onSelect }
447428 />
448429 ) ;
@@ -514,7 +495,7 @@ function mockTableProps(): TableProps<ObjectItem> {
514495 onSelect : jest . fn ( ) ,
515496 onSelectAll : jest . fn ( ) ,
516497 isSelected : jest . fn ( ( ) => false ) ,
517- selectionMethod : SelectionMethod . none ,
498+ selectionMethod : " none" ,
518499 selectionStatus : undefined
519500 } ;
520501}
0 commit comments