mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
This commit is contained in:
parent
73d3f92ae2
commit
7d0cc675aa
@ -456,6 +456,7 @@ packages/app-desktop/integration-tests/models/MainScreen.js
|
||||
packages/app-desktop/integration-tests/models/NoteEditorScreen.js
|
||||
packages/app-desktop/integration-tests/models/SettingsScreen.js
|
||||
packages/app-desktop/integration-tests/models/Sidebar.js
|
||||
packages/app-desktop/integration-tests/noteList.spec.js
|
||||
packages/app-desktop/integration-tests/richTextEditor.spec.js
|
||||
packages/app-desktop/integration-tests/sidebar.spec.js
|
||||
packages/app-desktop/integration-tests/simpleBackup.spec.js
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -435,6 +435,7 @@ packages/app-desktop/integration-tests/models/MainScreen.js
|
||||
packages/app-desktop/integration-tests/models/NoteEditorScreen.js
|
||||
packages/app-desktop/integration-tests/models/SettingsScreen.js
|
||||
packages/app-desktop/integration-tests/models/Sidebar.js
|
||||
packages/app-desktop/integration-tests/noteList.spec.js
|
||||
packages/app-desktop/integration-tests/richTextEditor.spec.js
|
||||
packages/app-desktop/integration-tests/sidebar.spec.js
|
||||
packages/app-desktop/integration-tests/simpleBackup.spec.js
|
||||
|
@ -48,4 +48,9 @@ export default class MainScreen {
|
||||
throw new Error('Unable to find settings menu item in application menus.');
|
||||
}
|
||||
}
|
||||
|
||||
public async search(text: string) {
|
||||
const searchBar = this.page.getByPlaceholder('Search...');
|
||||
await searchBar.fill(text);
|
||||
}
|
||||
}
|
||||
|
38
packages/app-desktop/integration-tests/noteList.spec.ts
Normal file
38
packages/app-desktop/integration-tests/noteList.spec.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import { test, expect } from './util/test';
|
||||
import MainScreen from './models/MainScreen';
|
||||
|
||||
test.describe('noteList', () => {
|
||||
test('should be possible to edit notes in a different notebook when searching', async ({ mainWindow }) => {
|
||||
const mainScreen = new MainScreen(mainWindow);
|
||||
const sidebar = mainScreen.sidebar;
|
||||
|
||||
const folderAHeader = await sidebar.createNewFolder('Folder A');
|
||||
await expect(folderAHeader).toBeVisible();
|
||||
|
||||
const folderBHeader = await sidebar.createNewFolder('Folder B');
|
||||
await expect(folderBHeader).toBeVisible();
|
||||
await folderBHeader.click();
|
||||
|
||||
await mainScreen.createNewNote('note-1');
|
||||
|
||||
await folderAHeader.click();
|
||||
await mainScreen.createNewNote('note-2');
|
||||
|
||||
// Search for and focus a note different from the folder we were in before searching.
|
||||
await mainScreen.search('/note-1');
|
||||
const note1Result = mainScreen.noteListContainer.getByText('note-1');
|
||||
await expect(note1Result).toBeAttached();
|
||||
await note1Result.click();
|
||||
|
||||
// Typing should not cause the note to disappear
|
||||
const editor = mainScreen.noteEditor;
|
||||
await editor.codeMirrorEditor.click();
|
||||
await mainWindow.keyboard.type('[Testing...](http://example.com/)');
|
||||
|
||||
// Wait to render
|
||||
await expect(editor.getNoteViewerIframe().locator('a', { hasText: 'Testing...' })).toBeVisible();
|
||||
|
||||
// Updating the title should force the sidebar to update sooner
|
||||
await expect(editor.noteTitleInput).toHaveValue('note-1');
|
||||
});
|
||||
});
|
@ -963,13 +963,14 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
for (let i = 0; i < newNotes.length; i++) {
|
||||
const n = newNotes[i];
|
||||
if (n.id === modNote.id) {
|
||||
const previousDisplayParentId = ('parent_id' in n) ? getDisplayParentId(n, draft.folders.find(f => f.id === n.parent_id)) : '';
|
||||
if (n.is_conflict && !modNote.is_conflict) {
|
||||
// Note was a conflict but was moved outside of
|
||||
// the conflict folder
|
||||
newNotes.splice(i, 1);
|
||||
noteFolderHasChanged = true;
|
||||
movedNotePreviousIndex = i;
|
||||
} else if (isViewingAllNotes || noteIsInFolder(modNote, draft.selectedFolderId)) {
|
||||
} else if (isViewingAllNotes || noteIsInFolder(modNote, previousDisplayParentId)) {
|
||||
// Note is still in the same folder
|
||||
// Merge the properties that have changed (in modNote) into
|
||||
// the object we already have.
|
||||
|
Loading…
Reference in New Issue
Block a user