@@ -1978,7 +1978,7 @@ describe('ListView', () => {
19781978 // filterableFields whitelist
19791979 // ============================
19801980 describe ( 'filterableFields' , ( ) => {
1981- it ( 'should restrict filter fields to the whitelist ' , ( ) => {
1981+ it ( 'should render with filterableFields whitelist restricting available fields ' , ( ) => {
19821982 const schema : ListViewSchema = {
19831983 type : 'list-view' ,
19841984 objectName : 'contacts' ,
@@ -1991,11 +1991,13 @@ describe('ListView', () => {
19911991 filterableFields : [ 'name' , 'email' ] ,
19921992 } ;
19931993
1994- const { container } = renderWithProvider ( < ListView schema = { schema } /> ) ;
1995- expect ( container ) . toBeTruthy ( ) ;
1994+ renderWithProvider ( < ListView schema = { schema } /> ) ;
1995+ // Filter button should still be visible
1996+ const filterButton = screen . getByRole ( 'button' , { name : / f i l t e r / i } ) ;
1997+ expect ( filterButton ) . toBeInTheDocument ( ) ;
19961998 } ) ;
19971999
1998- it ( 'should allow all fields when filterableFields is not set' , ( ) => {
2000+ it ( 'should render filter button when filterableFields is not set' , ( ) => {
19992001 const schema : ListViewSchema = {
20002002 type : 'list-view' ,
20012003 objectName : 'contacts' ,
@@ -2006,11 +2008,12 @@ describe('ListView', () => {
20062008 ] as any ,
20072009 } ;
20082010
2009- const { container } = renderWithProvider ( < ListView schema = { schema } /> ) ;
2010- expect ( container ) . toBeTruthy ( ) ;
2011+ renderWithProvider ( < ListView schema = { schema } /> ) ;
2012+ const filterButton = screen . getByRole ( 'button' , { name : / f i l t e r / i } ) ;
2013+ expect ( filterButton ) . toBeInTheDocument ( ) ;
20112014 } ) ;
20122015
2013- it ( 'should allow all fields when filterableFields is empty array' , ( ) => {
2016+ it ( 'should render filter button when filterableFields is empty array' , ( ) => {
20142017 const schema : ListViewSchema = {
20152018 type : 'list-view' ,
20162019 objectName : 'contacts' ,
@@ -2022,8 +2025,9 @@ describe('ListView', () => {
20222025 filterableFields : [ ] ,
20232026 } ;
20242027
2025- const { container } = renderWithProvider ( < ListView schema = { schema } /> ) ;
2026- expect ( container ) . toBeTruthy ( ) ;
2028+ renderWithProvider ( < ListView schema = { schema } /> ) ;
2029+ const filterButton = screen . getByRole ( 'button' , { name : / f i l t e r / i } ) ;
2030+ expect ( filterButton ) . toBeInTheDocument ( ) ;
20272031 } ) ;
20282032 } ) ;
20292033} ) ;
0 commit comments