feat: Initial clean release of CHM
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
这个提交包含在:
@@ -0,0 +1,68 @@
|
||||
import appReducer from './appReducer';
|
||||
import appDefaultState, { DEFAULT_ROUTE } from './appDefaultState';
|
||||
import Folder from '@joplin/lib/models/Folder';
|
||||
|
||||
const notesRoute = { type: 'NAV_GO', routeName: 'Notes', folderId: 'folder1' };
|
||||
const settingsRoute = { type: 'NAV_GO', routeName: 'Config' };
|
||||
const deletedFolderId = 'folder1';
|
||||
|
||||
const clearHistory = () => appReducer(appDefaultState, { type: 'NAV_GO', routeName: 'Notes', clearHistory: true });
|
||||
|
||||
// Simulates the exact scenario: navigate to a folder with no prior history, then delete it
|
||||
const makeDeletedRouteWithEmptyHistory = () => {
|
||||
let state = appReducer(appDefaultState, {
|
||||
type: 'NAV_GO',
|
||||
routeName: 'Notes',
|
||||
folderId: deletedFolderId,
|
||||
clearHistory: true,
|
||||
});
|
||||
state = appReducer(state, { type: 'FOLDER_DELETE', id: deletedFolderId });
|
||||
return state;
|
||||
};
|
||||
|
||||
describe('appReducer', () => {
|
||||
test('historyCanGoBack is true after navigating from Notes to Settings', () => {
|
||||
let state = clearHistory();
|
||||
state = appReducer(state, notesRoute);
|
||||
state = appReducer(state, settingsRoute);
|
||||
expect(state.historyCanGoBack).toBe(true);
|
||||
});
|
||||
|
||||
test('historyCanGoBack remains true after navigating away from a deleted route', () => {
|
||||
let state = makeDeletedRouteWithEmptyHistory();
|
||||
|
||||
// Navigate forward (e.g. open Settings)
|
||||
state = appReducer(state, settingsRoute);
|
||||
|
||||
expect(state.historyCanGoBack).toBe(true);
|
||||
});
|
||||
|
||||
test('going back from Settings after folder deletion lands on DEFAULT_ROUTE', () => {
|
||||
let state = makeDeletedRouteWithEmptyHistory();
|
||||
state = appReducer(state, settingsRoute);
|
||||
|
||||
// Go back
|
||||
state = appReducer(state, { type: 'NAV_BACK' });
|
||||
|
||||
expect(state.route).toEqual(DEFAULT_ROUTE);
|
||||
});
|
||||
|
||||
test('removes the conflicts folder from navigation when it disappears', () => {
|
||||
const conflictFolderId = Folder.conflictFolderId();
|
||||
let state = appReducer({
|
||||
...appDefaultState,
|
||||
folders: [{ ...Folder.conflictFolder(), id: conflictFolderId }],
|
||||
}, {
|
||||
type: 'NAV_GO',
|
||||
routeName: 'Notes',
|
||||
folderId: conflictFolderId,
|
||||
clearHistory: true,
|
||||
});
|
||||
|
||||
state = appReducer(state, { type: 'FOLDER_UPDATE_ALL', items: [] });
|
||||
state = appReducer(state, settingsRoute);
|
||||
state = appReducer(state, { type: 'NAV_BACK' });
|
||||
|
||||
expect(state.route).toEqual(DEFAULT_ROUTE);
|
||||
});
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户