@@ -49,17 +49,22 @@ describe('ListView Persistence', () => {
4949 id : 'my-custom-view' ,
5050 objectName : 'tasks' ,
5151 viewType : 'grid' , // Start with grid
52+ options : {
53+ kanban : {
54+ groupField : 'status' ,
55+ } ,
56+ } ,
5257 } ;
5358
5459 renderWithProvider ( < ListView schema = { schema } /> ) ;
5560
56- // Simulate changing to list view
57- const listButton = screen . getByLabelText ( 'List ' ) ;
58- fireEvent . click ( listButton ) ;
61+ // Simulate changing to kanban view
62+ const kanbanButton = screen . getByLabelText ( 'Kanban ' ) ;
63+ fireEvent . click ( kanbanButton ) ;
5964
6065 // Check scoped storage key
6166 const expectedKey = 'listview-tasks-my-custom-view-view' ;
62- expect ( localStorageMock . getItem ( expectedKey ) ) . toBe ( 'list ' ) ;
67+ expect ( localStorageMock . getItem ( expectedKey ) ) . toBe ( 'kanban ' ) ;
6368
6469 // Check fallback key is NOT set
6570 expect ( localStorageMock . getItem ( 'listview-tasks-view' ) ) . toBeNull ( ) ;
@@ -69,44 +74,53 @@ describe('ListView Persistence', () => {
6974 // Setup: View A (Global/Default) prefers Grid
7075 localStorageMock . setItem ( 'listview-tasks-view' , 'grid' ) ;
7176
72- // Setup: View B (Special) prefers List
73- // We define View B with valid options for Kanban to force it to render the button just in case,
74- // but we will test switching between Grid/List.
77+ // Setup: View B (Special) prefers Kanban
78+ // We define View B with valid options for Kanban to force it to render the button
7579
7680 const viewB_Schema : ListViewSchema = {
7781 type : 'list-view' ,
7882 id : 'special-view' ,
7983 objectName : 'tasks' ,
80- viewType : 'list' // Default to List
84+ viewType : 'kanban' , // Default to Kanban
85+ options : {
86+ kanban : {
87+ groupField : 'status' ,
88+ } ,
89+ } ,
8190 } ;
8291
8392 renderWithProvider ( < ListView schema = { viewB_Schema } /> ) ;
8493
85- // Should use the schema default 'list ' (since no storage exists for THIS view id)
94+ // Should use the schema default 'kanban ' (since no storage exists for THIS view id)
8695 // It should NOT use 'grid' from the global/default view.
8796
88- const listButton = screen . getByLabelText ( 'List ' ) ;
89- expect ( listButton . getAttribute ( 'data-state' ) ) . toBe ( 'on' ) ;
97+ const kanbanButton = screen . getByLabelText ( 'Kanban ' ) ;
98+ expect ( kanbanButton . getAttribute ( 'data-state' ) ) . toBe ( 'on' ) ;
9099
91100 const gridButton = screen . getByLabelText ( 'Grid' ) ;
92101 expect ( gridButton . getAttribute ( 'data-state' ) ) . toBe ( 'off' ) ;
93102 } ) ;
94103
95104 it ( 'should switch correctly when storage has a value for THIS view' , ( ) => {
96- // Setup: This specific view was previously set to 'list '
97- localStorageMock . setItem ( 'listview-tasks-my-board-view' , 'list ' ) ;
105+ // Setup: This specific view was previously set to 'kanban '
106+ localStorageMock . setItem ( 'listview-tasks-my-board-view' , 'kanban ' ) ;
98107
99108 const schema : ListViewSchema = {
100109 type : 'list-view' ,
101110 id : 'my-board' ,
102111 objectName : 'tasks' ,
103- viewType : 'grid' // Default in schema is grid
112+ viewType : 'grid' , // Default in schema is grid
113+ options : {
114+ kanban : {
115+ groupField : 'status' ,
116+ } ,
117+ } ,
104118 } ;
105119
106120 renderWithProvider ( < ListView schema = { schema } /> ) ;
107121
108- // Should respect storage ('list ') over schema ('grid')
109- const listButton = screen . getByLabelText ( 'List ' ) ;
110- expect ( listButton . getAttribute ( 'data-state' ) ) . toBe ( 'on' ) ;
122+ // Should respect storage ('kanban ') over schema ('grid')
123+ const kanbanButton = screen . getByLabelText ( 'Kanban ' ) ;
124+ expect ( kanbanButton . getAttribute ( 'data-state' ) ) . toBe ( 'on' ) ;
111125 } ) ;
112126} ) ;
0 commit comments