Skip to content

Commit 65768a2

Browse files
committed
test(app-shell): the widget render probe registers the chart renderer and carries a lit control
Claude-Session: https://claude.ai/code/session_01JQwxbafngYyQTJq78seG4v Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6a4d08a commit 65768a2

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

‎ui/packages/app-shell/src/views/metadata-admin/previews/AddWidgetPicker.oneRegistry-26745.test.tsx‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import { enumOptions } from '@object-ui/test-support';
2727
// `React.lazy` factory resolves at once instead of racing the test's wait
2828
// window (AGENTS.md, flaky-test discipline).
2929
import '@object-ui/plugin-dashboard';
30+
// The console registers the chart renderer the series families draw through.
31+
import '@object-ui/plugin-charts';
3032

3133
vi.mock('@object-ui/react', async (importOriginal) => {
3234
const mod = await importOriginal<typeof import('@object-ui/react')>();
@@ -128,8 +130,9 @@ describe('one widget-type registry, derived from the spec (objectstack#26745)',
128130
);
129131
});
130132

131-
it('every offered type renders through the real DashboardRenderer — no placeholder, no red panel', async () => {
132-
const widgets = WIDGET_TYPE_IDS.map((type, i) => ({
133+
/** Render one widget per type through the real renderer; the drawn text once every cell is laid out. */
134+
async function renderedText(types: readonly string[]): Promise<string> {
135+
const widgets = types.map((type, i) => ({
133136
id: `w_${i}`,
134137
type,
135138
title: `Widget ${type}`,
@@ -151,8 +154,17 @@ describe('one widget-type registry, derived from the spec (objectstack#26745)',
151154
const cells = container.querySelectorAll('[style*="grid-column"]');
152155
if (cells.length !== widgets.length) throw new Error(`expected ${widgets.length} widget cells, saw ${cells.length}`);
153156
});
154-
expect(container.textContent).not.toMatch(/chart type is not supported yet/);
155-
expect(container.textContent).not.toMatch(/Unknown component type/);
157+
return container.textContent ?? '';
158+
}
159+
160+
it('every offered type renders through the real DashboardRenderer — no placeholder, no red panel', async () => {
161+
const text = await renderedText(WIDGET_TYPE_IDS);
162+
expect(text).not.toMatch(/chart type is not supported yet/);
163+
expect(text).not.toMatch(/Unknown component type/);
164+
});
165+
166+
it('control: the same probe sees the placeholder a family with no renderer draws', async () => {
167+
expect(await renderedText(['heatmap'])).toMatch(/chart type is not supported yet/);
156168
});
157169

158170
it('every offered type has its Add-menu name and its Type-select name in en and zh', () => {

0 commit comments

Comments
 (0)