Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,25 @@ describe('AIChat', () => {
expect(mockClearChatButtonInstance.option).toHaveBeenCalledWith('disabled', false);
});

it('should disable chat suggestions via chatInstance option', () => {
const { aiChat } = createAIChat();
triggerContentTemplate();

aiChat.setDisabled(true);

expect(mockChatInstance.option).toHaveBeenCalledWith({ suggestions: { disabled: true } });
});

it('should enable chat suggestions via chatInstance option when set to false', () => {
const { aiChat } = createAIChat();
triggerContentTemplate();

aiChat.setDisabled(true);
aiChat.setDisabled(false);

expect(mockChatInstance.option).toHaveBeenCalledWith({ suggestions: { disabled: false } });
});

it('should not update when setting same disabled value', () => {
const { aiChat } = createAIChat();
triggerContentTemplate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ export class AIChat {
this.clearChatButtonInstance?.option('disabled', disabled);
}

private setChatSuggestionsDisabled(disabled: boolean): void {
this.chatInstance?.option({ suggestions: { disabled } });
}

public updateOptions(options: AIChatOptions, updatePopup: boolean, updateChat: boolean): void {
this.options = options;

Expand Down Expand Up @@ -308,6 +312,7 @@ export class AIChat {
this.setTextAreaDisabled(disabled);
this.setSpeechToTextDisabled(disabled);
this.setClearChatButtonDisabled(disabled);
this.setChatSuggestionsDisabled(disabled);
}

public renderAIMessage(message: AIMessage, container: HTMLElement): void {
Expand Down
Loading