mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-19 01:30:42 -07:00
feat(cli): add experimental.useOSC52Copy setting (#19488)
This commit is contained in:
committed by
GitHub
parent
ba3e327ba1
commit
09b623fbd7
@@ -125,6 +125,7 @@ describe('copyCommand', () => {
|
||||
|
||||
expect(mockCopyToClipboard).toHaveBeenCalledWith(
|
||||
'Hi there! How can I help you?',
|
||||
expect.anything(),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -143,7 +144,10 @@ describe('copyCommand', () => {
|
||||
|
||||
const result = await copyCommand.action(mockContext, '');
|
||||
|
||||
expect(mockCopyToClipboard).toHaveBeenCalledWith('Part 1: Part 2: Part 3');
|
||||
expect(mockCopyToClipboard).toHaveBeenCalledWith(
|
||||
'Part 1: Part 2: Part 3',
|
||||
expect.anything(),
|
||||
);
|
||||
expect(result).toEqual({
|
||||
type: 'message',
|
||||
messageType: 'info',
|
||||
@@ -170,7 +174,10 @@ describe('copyCommand', () => {
|
||||
|
||||
const result = await copyCommand.action(mockContext, '');
|
||||
|
||||
expect(mockCopyToClipboard).toHaveBeenCalledWith('Text part more text');
|
||||
expect(mockCopyToClipboard).toHaveBeenCalledWith(
|
||||
'Text part more text',
|
||||
expect.anything(),
|
||||
);
|
||||
expect(result).toEqual({
|
||||
type: 'message',
|
||||
messageType: 'info',
|
||||
@@ -201,7 +208,10 @@ describe('copyCommand', () => {
|
||||
|
||||
const result = await copyCommand.action(mockContext, '');
|
||||
|
||||
expect(mockCopyToClipboard).toHaveBeenCalledWith('Second AI response');
|
||||
expect(mockCopyToClipboard).toHaveBeenCalledWith(
|
||||
'Second AI response',
|
||||
expect.anything(),
|
||||
);
|
||||
expect(result).toEqual({
|
||||
type: 'message',
|
||||
messageType: 'info',
|
||||
@@ -230,6 +240,11 @@ describe('copyCommand', () => {
|
||||
messageType: 'error',
|
||||
content: `Failed to copy to the clipboard. ${clipboardError.message}`,
|
||||
});
|
||||
|
||||
expect(mockCopyToClipboard).toHaveBeenCalledWith(
|
||||
'AI response',
|
||||
expect.anything(),
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle non-Error clipboard errors', async () => {
|
||||
@@ -253,6 +268,11 @@ describe('copyCommand', () => {
|
||||
messageType: 'error',
|
||||
content: `Failed to copy to the clipboard. ${rejectedValue}`,
|
||||
});
|
||||
|
||||
expect(mockCopyToClipboard).toHaveBeenCalledWith(
|
||||
'AI response',
|
||||
expect.anything(),
|
||||
);
|
||||
});
|
||||
|
||||
it('should return info message when no text parts found in AI message', async () => {
|
||||
|
||||
@@ -38,7 +38,8 @@ export const copyCommand: SlashCommand = {
|
||||
|
||||
if (lastAiOutput) {
|
||||
try {
|
||||
await copyToClipboard(lastAiOutput);
|
||||
const settings = context.services.settings.merged;
|
||||
await copyToClipboard(lastAiOutput, settings);
|
||||
|
||||
return {
|
||||
type: 'message',
|
||||
|
||||
Reference in New Issue
Block a user