Skip to content

Commit c6be064

Browse files
committed
test(app-shell): the empty-state pick fills the held Format rule's field and message before it is written
Claude-Session: https://claude.ai/code/session_01JQwxbaA4X9WGDi4ZgwZ4PZ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6643455 commit c6be064

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎ui/packages/app-shell/src/views/studio-design/StudioEmptyState.panels-12514.test.tsx‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,22 @@ describe('objectui#12514 — Validations: the empty block opens the header’s N
102102
expect(menuIds('rule-preset-')).toEqual(fromEmpty);
103103
});
104104

105-
it('a pick from it writes the rule the header’s pick writes', () => {
105+
it('a pick from it writes the rule the header’s pick writes', async () => {
106106
const fromEmpty = vi.fn();
107107
render(<Harness onPatch={fromEmpty} />);
108108
fireEvent.click(screen.getByTestId('rules-empty-new'));
109109
fireEvent.click(screen.getByRole('button', { name: 'Advanced' }));
110110
fireEvent.click(screen.getByRole('button', { name: t('engine.studio.rules.typeFormat', 'en') }));
111-
expect(fromEmpty).toHaveBeenCalledTimes(1);
112111
// The rule is listed and open: the block gave way to the list.
113112
expect(screen.queryByTestId('rules-empty')).toBeNull();
113+
// objectstack#26731 — a new Format rule is written once it has a field and a message.
114+
expect(fromEmpty).not.toHaveBeenCalled();
115+
fireEvent.keyDown(screen.getByTestId('rule-field'), { key: 'ArrowDown' });
116+
fireEvent.click(within(await screen.findByRole('listbox')).getByRole('option', { name: 'Name (name)' }));
117+
fireEvent.change(screen.getByPlaceholderText(t('engine.studio.rules.messagePlaceholder', 'en')), {
118+
target: { value: 'Bad name' },
119+
});
120+
expect(fromEmpty).toHaveBeenCalledTimes(1);
114121
});
115122

116123
it('once the first rule lists, the menu hands focus to the header’s New', async () => {

0 commit comments

Comments
 (0)