Skip to content

Commit f1566eb

Browse files
Copilothotlong
andcommitted
feat: add ViewConfigPanel interaction tests, config sync integration tests, and viewTabs i18n key
- Add 11 interaction tests for emptyState inputs, ARIA inputs, rowActions, bulkActions, showRecordCount, allowPrinting, virtualScroll - Add 9 config sync integration tests for Grid, Kanban, Calendar, Timeline, Gantt, Gallery, Map, cross-view-type, and full property propagation - Add viewTabs i18n key to en.ts and zh.ts Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 4af6285 commit f1566eb

4 files changed

Lines changed: 735 additions & 0 deletions

File tree

apps/console/src/__tests__/ViewConfigPanel.test.tsx

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,4 +2150,184 @@ describe('ViewConfigPanel', () => {
21502150
fireEvent.click(screen.getByTestId('row-height-tall'));
21512151
expect(onViewUpdate).toHaveBeenCalledWith('rowHeight', 'tall');
21522152
});
2153+
2154+
// ── Interaction tests for emptyState, ARIA, rowActions, bulkActions, showRecordCount, allowPrinting, virtualScroll ──
2155+
2156+
it('updates emptyState title via input and calls onViewUpdate', () => {
2157+
const onViewUpdate = vi.fn();
2158+
render(
2159+
<ViewConfigPanel
2160+
open={true}
2161+
onClose={vi.fn()}
2162+
activeView={mockActiveView}
2163+
objectDef={mockObjectDef}
2164+
onViewUpdate={onViewUpdate}
2165+
/>
2166+
);
2167+
2168+
fireEvent.change(screen.getByTestId('input-emptyState-title'), { target: { value: 'No data' } });
2169+
expect(onViewUpdate).toHaveBeenCalledWith('emptyState', expect.objectContaining({ title: 'No data' }));
2170+
});
2171+
2172+
it('updates emptyState message via input and calls onViewUpdate', () => {
2173+
const onViewUpdate = vi.fn();
2174+
render(
2175+
<ViewConfigPanel
2176+
open={true}
2177+
onClose={vi.fn()}
2178+
activeView={mockActiveView}
2179+
objectDef={mockObjectDef}
2180+
onViewUpdate={onViewUpdate}
2181+
/>
2182+
);
2183+
2184+
fireEvent.change(screen.getByTestId('input-emptyState-message'), { target: { value: 'Try adding records' } });
2185+
expect(onViewUpdate).toHaveBeenCalledWith('emptyState', expect.objectContaining({ message: 'Try adding records' }));
2186+
});
2187+
2188+
it('updates emptyState icon via input and calls onViewUpdate', () => {
2189+
const onViewUpdate = vi.fn();
2190+
render(
2191+
<ViewConfigPanel
2192+
open={true}
2193+
onClose={vi.fn()}
2194+
activeView={mockActiveView}
2195+
objectDef={mockObjectDef}
2196+
onViewUpdate={onViewUpdate}
2197+
/>
2198+
);
2199+
2200+
fireEvent.change(screen.getByTestId('input-emptyState-icon'), { target: { value: 'inbox' } });
2201+
expect(onViewUpdate).toHaveBeenCalledWith('emptyState', expect.objectContaining({ icon: 'inbox' }));
2202+
});
2203+
2204+
it('updates ARIA label via input and calls onViewUpdate', () => {
2205+
const onViewUpdate = vi.fn();
2206+
render(
2207+
<ViewConfigPanel
2208+
open={true}
2209+
onClose={vi.fn()}
2210+
activeView={mockActiveView}
2211+
objectDef={mockObjectDef}
2212+
onViewUpdate={onViewUpdate}
2213+
/>
2214+
);
2215+
2216+
fireEvent.change(screen.getByTestId('input-aria-label'), { target: { value: 'Contacts table' } });
2217+
expect(onViewUpdate).toHaveBeenCalledWith('aria', expect.objectContaining({ label: 'Contacts table' }));
2218+
});
2219+
2220+
it('updates ARIA describedBy via input and calls onViewUpdate', () => {
2221+
const onViewUpdate = vi.fn();
2222+
render(
2223+
<ViewConfigPanel
2224+
open={true}
2225+
onClose={vi.fn()}
2226+
activeView={mockActiveView}
2227+
objectDef={mockObjectDef}
2228+
onViewUpdate={onViewUpdate}
2229+
/>
2230+
);
2231+
2232+
fireEvent.change(screen.getByTestId('input-aria-describedBy'), { target: { value: 'table-desc' } });
2233+
expect(onViewUpdate).toHaveBeenCalledWith('aria', expect.objectContaining({ describedBy: 'table-desc' }));
2234+
});
2235+
2236+
it('changes ARIA live region and calls onViewUpdate', () => {
2237+
const onViewUpdate = vi.fn();
2238+
render(
2239+
<ViewConfigPanel
2240+
open={true}
2241+
onClose={vi.fn()}
2242+
activeView={mockActiveView}
2243+
objectDef={mockObjectDef}
2244+
onViewUpdate={onViewUpdate}
2245+
/>
2246+
);
2247+
2248+
fireEvent.change(screen.getByTestId('select-aria-live'), { target: { value: 'polite' } });
2249+
expect(onViewUpdate).toHaveBeenCalledWith('aria', expect.objectContaining({ live: 'polite' }));
2250+
});
2251+
2252+
it('updates rowActions via input and calls onViewUpdate', () => {
2253+
const onViewUpdate = vi.fn();
2254+
render(
2255+
<ViewConfigPanel
2256+
open={true}
2257+
onClose={vi.fn()}
2258+
activeView={mockActiveView}
2259+
objectDef={mockObjectDef}
2260+
onViewUpdate={onViewUpdate}
2261+
/>
2262+
);
2263+
2264+
fireEvent.click(screen.getByText('console.objectView.rowActions'));
2265+
fireEvent.change(screen.getByTestId('input-rowActions'), { target: { value: 'edit, delete' } });
2266+
expect(onViewUpdate).toHaveBeenCalledWith('rowActions', ['edit', 'delete']);
2267+
});
2268+
2269+
it('updates bulkActions via input and calls onViewUpdate', () => {
2270+
const onViewUpdate = vi.fn();
2271+
render(
2272+
<ViewConfigPanel
2273+
open={true}
2274+
onClose={vi.fn()}
2275+
activeView={mockActiveView}
2276+
objectDef={mockObjectDef}
2277+
onViewUpdate={onViewUpdate}
2278+
/>
2279+
);
2280+
2281+
fireEvent.click(screen.getByText('console.objectView.bulkActions'));
2282+
fireEvent.change(screen.getByTestId('input-bulkActions'), { target: { value: 'delete, export' } });
2283+
expect(onViewUpdate).toHaveBeenCalledWith('bulkActions', ['delete', 'export']);
2284+
});
2285+
2286+
it('toggles showRecordCount and calls onViewUpdate', () => {
2287+
const onViewUpdate = vi.fn();
2288+
render(
2289+
<ViewConfigPanel
2290+
open={true}
2291+
onClose={vi.fn()}
2292+
activeView={mockActiveView}
2293+
objectDef={mockObjectDef}
2294+
onViewUpdate={onViewUpdate}
2295+
/>
2296+
);
2297+
2298+
fireEvent.click(screen.getByTestId('toggle-showRecordCount'));
2299+
expect(onViewUpdate).toHaveBeenCalledWith('showRecordCount', true);
2300+
});
2301+
2302+
it('toggles allowPrinting and calls onViewUpdate', () => {
2303+
const onViewUpdate = vi.fn();
2304+
render(
2305+
<ViewConfigPanel
2306+
open={true}
2307+
onClose={vi.fn()}
2308+
activeView={mockActiveView}
2309+
objectDef={mockObjectDef}
2310+
onViewUpdate={onViewUpdate}
2311+
/>
2312+
);
2313+
2314+
fireEvent.click(screen.getByTestId('toggle-allowPrinting'));
2315+
expect(onViewUpdate).toHaveBeenCalledWith('allowPrinting', true);
2316+
});
2317+
2318+
it('toggles virtualScroll and calls onViewUpdate', () => {
2319+
const onViewUpdate = vi.fn();
2320+
render(
2321+
<ViewConfigPanel
2322+
open={true}
2323+
onClose={vi.fn()}
2324+
activeView={mockActiveView}
2325+
objectDef={mockObjectDef}
2326+
onViewUpdate={onViewUpdate}
2327+
/>
2328+
);
2329+
2330+
fireEvent.click(screen.getByTestId('toggle-virtualScroll'));
2331+
expect(onViewUpdate).toHaveBeenCalledWith('virtualScroll', true);
2332+
});
21532333
});

packages/i18n/src/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ const en = {
295295
ariaDescribedBy: 'ARIA described by',
296296
ariaLive: 'ARIA live',
297297
accessibility: 'Accessibility',
298+
viewTabs: 'View Tabs',
298299
},
299300
localeSwitcher: {
300301
label: 'Language',

packages/i18n/src/locales/zh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ const zh = {
295295
ariaDescribedBy: 'ARIA 描述',
296296
ariaLive: 'ARIA 实时区域',
297297
accessibility: '无障碍',
298+
viewTabs: '视图标签',
298299
},
299300
localeSwitcher: {
300301
label: '语言',

0 commit comments

Comments
 (0)