文件
mynode/packages/app-desktop/gui/NoteListControls/NoteListControls.test.ts
chen 301194963b
一些检查失败了
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
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

34 行
1.3 KiB
TypeScript

describe('NoteListControls compact text logic', () => {
it('uses concise labels in single-line mode or medium breakpoint', () => {
const getNoteButtonText = (breakpoint: number, dynamicBreakpoints: any, lineCount: number) => {
if (breakpoint === dynamicBreakpoints.Sm) {
return '';
} else if (breakpoint === dynamicBreakpoints.Md || lineCount === 1) {
return '笔记';
} else {
return '新建笔记';
}
};
const getTodoButtonText = (breakpoint: number, dynamicBreakpoints: any, lineCount: number) => {
if (breakpoint === dynamicBreakpoints.Sm) {
return '';
} else if (breakpoint === dynamicBreakpoints.Md || lineCount === 1) {
return '待办';
} else {
return '新建待办';
}
};
const dynamicBreakpoints = { Sm: 100, Md: 200, Lg: 300, Xl: 400 };
// Single line mode should always use concise 2-char labels to preserve search bar space
expect(getNoteButtonText(dynamicBreakpoints.Xl, dynamicBreakpoints, 1)).toBe('笔记');
expect(getTodoButtonText(dynamicBreakpoints.Xl, dynamicBreakpoints, 1)).toBe('待办');
// Small breakpoint should collapse to icon-only (empty string)
expect(getNoteButtonText(dynamicBreakpoints.Sm, dynamicBreakpoints, 2)).toBe('');
expect(getTodoButtonText(dynamicBreakpoints.Sm, dynamicBreakpoints, 2)).toBe('');
});
});