diff --git a/.gitignore b/.gitignore index 05cbae003c..74bd27a07e 100644 --- a/.gitignore +++ b/.gitignore @@ -595,6 +595,7 @@ packages/app-desktop/gui/utils/convertToScreenCoordinates.js packages/app-desktop/gui/utils/dragAndDrop.js packages/app-desktop/gui/utils/loadScript.js packages/app-desktop/gulpfile.js +packages/app-desktop/integration-tests/chatPanel.spec.js packages/app-desktop/integration-tests/goToAnything.spec.js packages/app-desktop/integration-tests/main.spec.js packages/app-desktop/integration-tests/markdownEditor.spec.js diff --git a/.ignore.eslint b/.ignore.eslint index 49606c7be0..05fcab3eda 100644 --- a/.ignore.eslint +++ b/.ignore.eslint @@ -620,6 +620,7 @@ packages/app-desktop/gui/utils/convertToScreenCoordinates.js packages/app-desktop/gui/utils/dragAndDrop.js packages/app-desktop/gui/utils/loadScript.js packages/app-desktop/gulpfile.js +packages/app-desktop/integration-tests/chatPanel.spec.js packages/app-desktop/integration-tests/goToAnything.spec.js packages/app-desktop/integration-tests/main.spec.js packages/app-desktop/integration-tests/markdownEditor.spec.js diff --git a/packages/app-desktop/gui/ResizableLayout/LayoutItemContainer.tsx b/packages/app-desktop/gui/ResizableLayout/LayoutItemContainer.tsx index 6636aec28d..4f48dd9528 100644 --- a/packages/app-desktop/gui/ResizableLayout/LayoutItemContainer.tsx +++ b/packages/app-desktop/gui/ResizableLayout/LayoutItemContainer.tsx @@ -34,43 +34,35 @@ const LayoutItemContainer: React.FC = ({ const canResizeBottom = parentDir === LayoutItemDirection.Column && !isLastChild; const className = `resizableLayoutItem rli-${item.key}`; - if (canResizeRight || canResizeBottom) { - const enable = { - top: false, - right: canResizeRight, - bottom: canResizeBottom, - left: false, - topRight: false, - bottomRight: false, - bottomLeft: false, - topLeft: false, - }; + const enable = { + top: false, + right: canResizeRight, + bottom: canResizeBottom, + left: false, + topRight: false, + bottomRight: false, + bottomLeft: false, + topLeft: false, + }; - return ( - - {children} - - ); - } else { - return ( -
- {children} -
- ); - } + return ( + + {children} + + ); }; export default LayoutItemContainer; diff --git a/packages/app-desktop/integration-tests/chatPanel.spec.ts b/packages/app-desktop/integration-tests/chatPanel.spec.ts new file mode 100644 index 0000000000..821a223e30 --- /dev/null +++ b/packages/app-desktop/integration-tests/chatPanel.spec.ts @@ -0,0 +1,28 @@ +import { test } from './util/test'; +import MainScreen from './models/MainScreen'; + +test.describe('chatPanel', () => { + test('should not clear undo history when opening/closing the chat panel', async ({ mainWindow, electronApp }) => { + const mainScreen = await new MainScreen(mainWindow).setup(); + await mainScreen.createNewNote('test'); + + const noteEditor = mainScreen.noteEditor; + await noteEditor.focusCodeMirrorEditor(); + await mainWindow.keyboard.type('Testing'); + await noteEditor.expectToHaveText('Testing'); + + await mainScreen.chatPanel.configure(electronApp); + await mainScreen.chatPanel.open(electronApp); + await mainScreen.chatPanel.close(electronApp); + + // Should still have the correct content + await noteEditor.expectToHaveText('Testing'); + + // Should be possible to undo everything + for (let i = 0; i < 'Testing'.length; i++) { + await noteEditor.undo(electronApp); + } + await noteEditor.expectToHaveText(/^[\n]?$/); + }); +}); + diff --git a/packages/app-desktop/integration-tests/models/ChatPanel.ts b/packages/app-desktop/integration-tests/models/ChatPanel.ts index ab71cf1ae0..98b7f898af 100644 --- a/packages/app-desktop/integration-tests/models/ChatPanel.ts +++ b/packages/app-desktop/integration-tests/models/ChatPanel.ts @@ -23,6 +23,12 @@ export default class ChatPanel { await this.container.waitFor(); } + public async close(electronApp: ElectronApplication) { + await this.container.waitFor(); + await this.mainScreen_.goToAnything.runCommand(electronApp, 'toggleAiChat'); + await expect(this.container).not.toBeVisible(); + } + public async sendMessage(message: string) { await this.textInput.fill(message); await this.textInput.press('Enter'); diff --git a/packages/app-desktop/integration-tests/models/NoteEditorScreen.ts b/packages/app-desktop/integration-tests/models/NoteEditorScreen.ts index f57933d42e..62633ab138 100644 --- a/packages/app-desktop/integration-tests/models/NoteEditorScreen.ts +++ b/packages/app-desktop/integration-tests/models/NoteEditorScreen.ts @@ -46,6 +46,10 @@ export default class NoteEditorScreen { this.richTextCodeEditor = new EditorCodeDialog(page_); } + public async undo(electronApp: ElectronApplication) { + await activateMainMenuItem(electronApp, 'Undo'); + } + public toolbarButtonLocator(title: string) { return this.containerLocator.getByRole('button', { name: title }); }