Skip to content

Commit 34ada07

Browse files
authored
Merge pull request #385 from objectstack-ai/copilot/fix-all-and-test
2 parents 969ac69 + e28dd11 commit 34ada07

File tree

6 files changed

+54
-32
lines changed

6 files changed

+54
-32
lines changed

packages/plugin-aggrid/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Plugin AgGrid', () => {
1313
// Import all renderers to register them
1414
beforeAll(async () => {
1515
await import('./index');
16-
});
16+
}, 15000); // Increase timeout to 15 seconds for async import
1717

1818
describe('aggrid component', () => {
1919
it('should be registered in ComponentRegistry', () => {

packages/plugin-charts/src/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ export type { BarChartSchema } from './types';
1515
export { ChartBarRenderer, ChartRenderer };
1616
export { ObjectChart } from './ObjectChart';
1717

18+
// Standard Export Protocol - for manual integration
19+
export const chartComponents = {
20+
'bar-chart': ChartBarRenderer,
21+
'chart': ChartRenderer,
22+
};
23+
1824
// Register the component with the ComponentRegistry
1925
ComponentRegistry.register(
2026
'bar-chart',

packages/plugin-kanban/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Plugin Kanban', () => {
1313
// Import all renderers to register them
1414
beforeAll(async () => {
1515
await import('./index');
16-
});
16+
}, 15000); // Increase timeout to 15 seconds for async import
1717

1818
describe('kanban component', () => {
1919
it('should be registered in ComponentRegistry', () => {

packages/plugin-list/src/__tests__/ListView.test.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('ListView', () => {
7575
};
7676

7777
renderWithProvider(<ListView schema={schema} />);
78-
const searchInput = screen.getByPlaceholderText(/search/i);
78+
const searchInput = screen.getByPlaceholderText(/find/i);
7979
expect(searchInput).toBeInTheDocument();
8080
});
8181

@@ -89,7 +89,7 @@ describe('ListView', () => {
8989
};
9090

9191
renderWithProvider(<ListView schema={schema} onSearchChange={onSearchChange} />);
92-
const searchInput = screen.getByPlaceholderText(/search/i);
92+
const searchInput = screen.getByPlaceholderText(/find/i);
9393

9494
fireEvent.change(searchInput, { target: { value: 'test' } });
9595
expect(onSearchChange).toHaveBeenCalledWith('test');
@@ -101,22 +101,24 @@ describe('ListView', () => {
101101
objectName: 'contacts',
102102
viewType: 'grid',
103103
fields: ['name', 'email'],
104+
options: {
105+
kanban: {
106+
groupField: 'status',
107+
},
108+
},
104109
};
105110

106111
renderWithProvider(<ListView schema={schema} />);
107112

108-
// Find list view button and click it
109-
// Using getAllByRole because there might be multiple buttons
110-
const buttons = screen.getAllByRole('radio'); // ToggleGroup usually uses radio role if type="single"
111-
// However, if it's implemented as buttons using ToggleGroup which is roving tabindex...
112-
// Let's try finding by aria-label which ViewSwitcher sets
113-
const listButton = screen.getByLabelText('List');
114-
115-
fireEvent.click(listButton);
113+
// Find kanban view button and click it
114+
// ViewSwitcher uses buttons with aria-label
115+
const kanbanButton = screen.getByLabelText('Kanban');
116+
117+
fireEvent.click(kanbanButton);
116118

117119
// localStorage should be set with new view
118120
const storageKey = 'listview-contacts-view';
119-
expect(localStorageMock.getItem(storageKey)).toBe('list');
121+
expect(localStorageMock.getItem(storageKey)).toBe('kanban');
120122
});
121123

122124
it('should call onViewChange when view is changed', () => {
@@ -194,7 +196,7 @@ describe('ListView', () => {
194196
};
195197

196198
renderWithProvider(<ListView schema={schema} />);
197-
const searchInput = screen.getByPlaceholderText(/search/i) as HTMLInputElement;
199+
const searchInput = screen.getByPlaceholderText(/find/i) as HTMLInputElement;
198200

199201
// Type in search
200202
fireEvent.change(searchInput, { target: { value: 'test' } });

packages/plugin-list/src/__tests__/ListViewPersistence.test.tsx

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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
});

packages/plugin-markdown/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Plugin Markdown', () => {
1313
// Import all renderers to register them
1414
beforeAll(async () => {
1515
await import('./index');
16-
});
16+
}, 15000); // Increase timeout to 15 seconds for async import
1717

1818
describe('markdown component', () => {
1919
it('should be registered in ComponentRegistry', () => {

0 commit comments

Comments
 (0)