@@ -261,4 +261,96 @@ describe('ListView', () => {
261261 expect ( screen . getByText ( 'No contacts yet' ) ) . toBeInTheDocument ( ) ;
262262 expect ( screen . getByText ( 'Add your first contact to get started.' ) ) . toBeInTheDocument ( ) ;
263263 } ) ;
264+
265+ it ( 'should render quick filters when configured' , ( ) => {
266+ const schema : ListViewSchema = {
267+ type : 'list-view' ,
268+ objectName : 'contacts' ,
269+ viewType : 'grid' ,
270+ fields : [ 'name' , 'email' ] ,
271+ quickFilters : [
272+ { id : 'active' , label : 'Active' , filters : [ [ 'status' , '=' , 'active' ] ] } ,
273+ { id : 'vip' , label : 'VIP' , filters : [ [ 'vip' , '=' , true ] ] , defaultActive : true } ,
274+ ] ,
275+ } ;
276+
277+ renderWithProvider ( < ListView schema = { schema } /> ) ;
278+
279+ expect ( screen . getByTestId ( 'quick-filters' ) ) . toBeInTheDocument ( ) ;
280+ expect ( screen . getByText ( 'Active' ) ) . toBeInTheDocument ( ) ;
281+ expect ( screen . getByText ( 'VIP' ) ) . toBeInTheDocument ( ) ;
282+ } ) ;
283+
284+ it ( 'should render hide fields popover' , ( ) => {
285+ const schema : ListViewSchema = {
286+ type : 'list-view' ,
287+ objectName : 'contacts' ,
288+ viewType : 'grid' ,
289+ fields : [ 'name' , 'email' , 'phone' ] ,
290+ } ;
291+
292+ renderWithProvider ( < ListView schema = { schema } /> ) ;
293+
294+ const hideFieldsButton = screen . getByRole ( 'button' , { name : / h i d e f i e l d s / i } ) ;
295+ expect ( hideFieldsButton ) . toBeInTheDocument ( ) ;
296+ } ) ;
297+
298+ it ( 'should render density mode button' , ( ) => {
299+ const schema : ListViewSchema = {
300+ type : 'list-view' ,
301+ objectName : 'contacts' ,
302+ viewType : 'grid' ,
303+ fields : [ 'name' , 'email' ] ,
304+ } ;
305+
306+ renderWithProvider ( < ListView schema = { schema } /> ) ;
307+
308+ // Default density mode is 'comfortable'
309+ const densityButton = screen . getByTitle ( 'Density: comfortable' ) ;
310+ expect ( densityButton ) . toBeInTheDocument ( ) ;
311+ } ) ;
312+
313+ it ( 'should render export button when exportOptions configured' , ( ) => {
314+ const schema : ListViewSchema = {
315+ type : 'list-view' ,
316+ objectName : 'contacts' ,
317+ viewType : 'grid' ,
318+ fields : [ 'name' , 'email' ] ,
319+ exportOptions : {
320+ formats : [ 'csv' , 'json' ] ,
321+ } ,
322+ } ;
323+
324+ renderWithProvider ( < ListView schema = { schema } /> ) ;
325+
326+ const exportButton = screen . getByRole ( 'button' , { name : / e x p o r t / i } ) ;
327+ expect ( exportButton ) . toBeInTheDocument ( ) ;
328+ } ) ;
329+
330+ it ( 'should not render export button when exportOptions not configured' , ( ) => {
331+ const schema : ListViewSchema = {
332+ type : 'list-view' ,
333+ objectName : 'contacts' ,
334+ viewType : 'grid' ,
335+ fields : [ 'name' , 'email' ] ,
336+ } ;
337+
338+ renderWithProvider ( < ListView schema = { schema } /> ) ;
339+
340+ const exportButtons = screen . queryAllByRole ( 'button' , { name : / e x p o r t / i } ) ;
341+ expect ( exportButtons . length ) . toBe ( 0 ) ;
342+ } ) ;
343+
344+ it ( 'should apply hiddenFields to effective fields' , ( ) => {
345+ const schema : ListViewSchema = {
346+ type : 'list-view' ,
347+ objectName : 'contacts' ,
348+ viewType : 'grid' ,
349+ fields : [ 'name' , 'email' , 'phone' ] ,
350+ hiddenFields : [ 'phone' ] ,
351+ } ;
352+
353+ const { container } = renderWithProvider ( < ListView schema = { schema } /> ) ;
354+ expect ( container ) . toBeTruthy ( ) ;
355+ } ) ;
264356} ) ;
0 commit comments