-
Notifications
You must be signed in to change notification settings - Fork 2
fix: wire ViewConfigPanel toolbar toggles through to ListView #720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -813,6 +813,14 @@ export const ObjectView: React.FC<ObjectViewProps> = ({ | |||||||||||||
| densityMode: activeView?.densityMode, | ||||||||||||||
| groupBy: activeView?.groupBy, | ||||||||||||||
| options: currentNamedViewConfig?.options || activeView, | ||||||||||||||
| // Propagate toolbar toggle flags | ||||||||||||||
| showSearch: activeView?.showSearch ?? schema.showSearch, | ||||||||||||||
| showFilters: activeView?.showFilters ?? schema.showFilters, | ||||||||||||||
| showSort: activeView?.showSort ?? schema.showSort, | ||||||||||||||
| // Propagate display properties | ||||||||||||||
| striped: activeView?.striped ?? (schema as any).striped, | ||||||||||||||
| bordered: activeView?.bordered ?? (schema as any).bordered, | ||||||||||||||
| color: activeView?.color ?? (schema as any).color, | ||||||||||||||
|
Comment on lines
+821
to
+823
|
||||||||||||||
| striped: activeView?.striped ?? (schema as any).striped, | |
| bordered: activeView?.bordered ?? (schema as any).bordered, | |
| color: activeView?.color ?? (schema as any).color, | |
| striped: activeView?.striped ?? schema.table?.striped, | |
| bordered: activeView?.bordered ?? schema.table?.bordered, | |
| color: activeView?.color ?? currentNamedViewConfig?.color, |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -549,5 +549,64 @@ describe('ObjectView', () => { | |
| // Component renders without crash — showSort is respected | ||
| expect(screen.getByTestId('object-grid')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('should include showSearch/showFilters/showSort in renderListView schema', async () => { | ||
| const schema: ObjectViewSchema = { | ||
| type: 'object-view', | ||
| objectName: 'contacts', | ||
| showSearch: false, | ||
| showFilters: false, | ||
| showSort: false, | ||
| }; | ||
|
|
||
| const renderListViewSpy = vi.fn(({ schema: listSchema }: any) => ( | ||
| <div data-testid="custom-list">Custom ListView</div> | ||
| )); | ||
|
Comment on lines
+562
to
+564
|
||
|
|
||
| render( | ||
| <ObjectView | ||
| schema={schema} | ||
| dataSource={mockDataSource} | ||
| renderListView={renderListViewSpy} | ||
| />, | ||
| ); | ||
|
|
||
| expect(renderListViewSpy).toHaveBeenCalled(); | ||
| const callSchema = renderListViewSpy.mock.calls[0]?.[0]?.schema; | ||
| expect(callSchema?.showSearch).toBe(false); | ||
| expect(callSchema?.showFilters).toBe(false); | ||
| expect(callSchema?.showSort).toBe(false); | ||
| }); | ||
|
|
||
| it('should propagate showSearch/showFilters/showSort from activeView in renderListView', async () => { | ||
| const schema: ObjectViewSchema = { | ||
| type: 'object-view', | ||
| objectName: 'contacts', | ||
| }; | ||
|
|
||
| const renderListViewSpy = vi.fn(({ schema: listSchema }: any) => ( | ||
| <div data-testid="custom-list">Custom ListView</div> | ||
| )); | ||
|
Comment on lines
+587
to
+589
|
||
|
|
||
| const views = [ | ||
| { id: 'v1', label: 'View 1', type: 'grid' as const, showSearch: false, showFilters: false, showSort: false }, | ||
| ]; | ||
|
|
||
| render( | ||
| <ObjectView | ||
| schema={schema} | ||
| dataSource={mockDataSource} | ||
| views={views} | ||
| activeViewId="v1" | ||
| renderListView={renderListViewSpy} | ||
| />, | ||
| ); | ||
|
|
||
| expect(renderListViewSpy).toHaveBeenCalled(); | ||
| const callSchema = renderListViewSpy.mock.calls[0]?.[0]?.schema; | ||
| expect(callSchema?.showSearch).toBe(false); | ||
| expect(callSchema?.showFilters).toBe(false); | ||
| expect(callSchema?.showSort).toBe(false); | ||
| }); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On small screens the button label is hidden (
hidden sm:inline), and the icon doesn’t provide an accessible name. Add anaria-label(and/ortitle) to the Search trigger button so it remains accessible when rendered icon-only.