Skip to content

Commit 7e4a124

Browse files
committed
test(console): drop an unused parameter from the form-view chrome pin
Claude-Session: https://claude.ai/code/session_01JQwxbabN2bfLWeaoNk6Jue Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0f65bdf commit 7e4a124

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

‎ui/apps/console/src/components/FormPage.formViewChrome-26843.test.tsx‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function stubFetch(form: Record<string, unknown>) {
6363
});
6464
}
6565

66-
function renderAt(url: string, mode: 'internal' | 'public') {
66+
function renderAt(url: string) {
6767
createI18n({ defaultLanguage: 'en', detectBrowserLanguage: false });
6868
return render(
6969
<MemoryRouter initialEntries={[url]}>
@@ -85,28 +85,28 @@ afterEach(() => {
8585
describe('FormPage renders the form view\'s buttons (#26843)', () => {
8686
it('internal: the authored submit label shows, and a hidden cancel is gone', async () => {
8787
vi.stubGlobal('fetch', stubFetch({ buttons: { submit: { label: 'File inquiry' }, cancel: { show: false } } }));
88-
renderAt('/forms/showcase_inquiry.intake', 'internal');
88+
renderAt('/forms/showcase_inquiry.intake');
8989
expect(await screen.findByRole('button', { name: 'File inquiry' })).toBeInTheDocument();
9090
expect(screen.queryByRole('button', { name: 'Cancel' })).toBeNull();
9191
});
9292

9393
it('internal: an authored cancel label shows; a hidden submit is gone', async () => {
9494
vi.stubGlobal('fetch', stubFetch({ buttons: { submit: { show: false }, cancel: { label: 'Back' } } }));
95-
const { container } = renderAt('/forms/showcase_inquiry.intake', 'internal');
95+
const { container } = renderAt('/forms/showcase_inquiry.intake');
9696
expect(await screen.findByRole('button', { name: 'Back' })).toBeInTheDocument();
9797
expect(container.querySelector('button[type="submit"]')).toBeNull();
9898
});
9999

100100
it('public: the authored submit label shows, and there is still no Cancel', async () => {
101101
vi.stubGlobal('fetch', stubFetch({ buttons: { submit: { label: 'Send' }, cancel: { label: 'Back' } } }));
102-
renderAt('/f/intake', 'public');
102+
renderAt('/f/intake');
103103
expect(await screen.findByRole('button', { name: 'Send' })).toBeInTheDocument();
104104
expect(screen.queryByRole('button', { name: 'Back' })).toBeNull();
105105
});
106106

107107
it('CONTROL: no `buttons` — the page\'s own Submit and Cancel', async () => {
108108
vi.stubGlobal('fetch', stubFetch({}));
109-
renderAt('/forms/showcase_inquiry.intake', 'internal');
109+
renderAt('/forms/showcase_inquiry.intake');
110110
expect(await screen.findByRole('button', { name: 'Submit' })).toBeInTheDocument();
111111
expect(screen.getByRole('button', { name: 'Cancel' })).toBeInTheDocument();
112112
});
@@ -115,28 +115,28 @@ describe('FormPage renders the form view\'s buttons (#26843)', () => {
115115
describe('FormPage seeds a create with the form view\'s defaults (#26843)', () => {
116116
it('a create opens with them, over the object\'s own field default', async () => {
117117
vi.stubGlobal('fetch', stubFetch({ defaults: { title: 'Website lead', channel: 'web' } }));
118-
renderAt('/forms/showcase_inquiry.intake', 'internal');
118+
renderAt('/forms/showcase_inquiry.intake');
119119
await waitFor(() => expect(input('title')?.value).toBe('Website lead'));
120120
expect(input('channel')?.value).toBe('web');
121121
});
122122

123123
it('a `prefill_` param still wins per field', async () => {
124124
vi.stubGlobal('fetch', stubFetch({ defaults: { title: 'Website lead', channel: 'web' } }));
125-
renderAt('/forms/showcase_inquiry.intake?prefill_channel=chat', 'internal');
125+
renderAt('/forms/showcase_inquiry.intake?prefill_channel=chat');
126126
await waitFor(() => expect(input('channel')?.value).toBe('chat'));
127127
expect(input('title')?.value).toBe('Website lead');
128128
});
129129

130130
it('an edit reads the stored record, never the defaults', async () => {
131131
vi.stubGlobal('fetch', stubFetch({ defaults: { title: 'Website lead', channel: 'web' } }));
132-
renderAt('/forms/showcase_inquiry.intake?recordId=r1', 'internal');
132+
renderAt('/forms/showcase_inquiry.intake?recordId=r1');
133133
await waitFor(() => expect(input('title')?.value).toBe('Stored'));
134134
expect(input('channel')?.value).toBe('email');
135135
});
136136

137137
it('CONTROL: no defaults — the object\'s own field default, else blank', async () => {
138138
vi.stubGlobal('fetch', stubFetch({}));
139-
renderAt('/forms/showcase_inquiry.intake', 'internal');
139+
renderAt('/forms/showcase_inquiry.intake');
140140
await waitFor(() => expect(input('channel')?.value).toBe('phone'));
141141
expect(input('title')?.value).toBe('');
142142
});

0 commit comments

Comments
 (0)