You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by yo...@apache.org on 2026/10/17 00:22:40 UTC
(zeppelin) 09/17: [ZEPPELIN-6746] Pin the controlled value of the composer in tests
This is an automated email from the ASF dual-hosted git repository.
voidmatcha pushed a commit to branch branch-voidmatcha-assistant-integration-temp
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
commit e9a9726ee33297fd411bb51d558c02289a9defb9
Author: YONGJAE LEE <de...@gmail.com>
AuthorDate: Wed Oct 14 01:00:34 2026 +0900
[ZEPPELIN-6746] Pin the controlled value of the composer in tests
---
.../src/entities/assistant/ui/AssistantComposer.spec.tsx | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/AssistantComposer.spec.tsx b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/AssistantComposer.spec.tsx
index faf8004c7f..1e0bc0d865 100644
--- a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/AssistantComposer.spec.tsx
+++ b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/AssistantComposer.spec.tsx
@@ -30,6 +30,17 @@ describe('AssistantComposer', () => {
const { onChange } = renderComposer();
fireEvent.change(input(), { target: { value: 'Explain this notebook' } });
expect(onChange).toHaveBeenCalledWith('Explain this notebook');
+ // The parent owns the value, so the field keeps showing what the parent passed.
+ expect(input().value).toBe('');
+ });
+
+ it('shows and sends the value the parent sets later', () => {
+ const onSubmit = vi.fn();
+ const { rerender } = render(<AssistantComposer value="" onChange={vi.fn()} onSubmit={onSubmit} />);
+ rerender(<AssistantComposer value="Explain this notebook" onChange={vi.fn()} onSubmit={onSubmit} />);
+ expect(input().value).toBe('Explain this notebook');
+ fireEvent.click(send());
+ expect(onSubmit).toHaveBeenCalledWith('Explain this notebook');
});
it('sends the trimmed question from the button and from Enter', () => {
@@ -59,6 +70,7 @@ describe('AssistantComposer', () => {
expect(input().disabled).toBe(true);
expect(send().disabled).toBe(true);
expect(screen.getByRole('note').textContent).toBe('This conversation belongs to another user.');
+ pressEnter();
fireEvent.submit(input().form!);
expect(onSubmit).not.toHaveBeenCalled();
});