一些检查失败了
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
73 行
1.2 KiB
TypeScript
73 行
1.2 KiB
TypeScript
import { NoteListColumns } from '@joplin/lib/services/plugins/api/noteListType';
|
|
import { dropHeaderAt, InsertAt } from './useDragAndDrop';
|
|
|
|
const defaultColumns: NoteListColumns = [
|
|
{
|
|
name: 'note.todo_completed',
|
|
width: 40,
|
|
},
|
|
{
|
|
name: 'note.user_updated_time',
|
|
width: 100,
|
|
},
|
|
{
|
|
name: 'note.title',
|
|
width: 0,
|
|
},
|
|
];
|
|
|
|
describe('useDragAndDrop', () => {
|
|
|
|
test.each([
|
|
[
|
|
defaultColumns,
|
|
{
|
|
name: 'note.title',
|
|
},
|
|
{
|
|
columnName: 'note.todo_completed',
|
|
location: 'before',
|
|
},
|
|
[
|
|
'note.title',
|
|
'note.todo_completed',
|
|
'note.user_updated_time',
|
|
],
|
|
],
|
|
[
|
|
defaultColumns,
|
|
{
|
|
name: 'note.title',
|
|
},
|
|
{
|
|
columnName: 'note.user_updated_time',
|
|
location: 'before',
|
|
},
|
|
[
|
|
'note.todo_completed',
|
|
'note.title',
|
|
'note.user_updated_time',
|
|
],
|
|
],
|
|
[
|
|
defaultColumns,
|
|
{
|
|
name: 'note.title',
|
|
},
|
|
{
|
|
columnName: 'note.user_updated_time',
|
|
location: 'after',
|
|
},
|
|
[
|
|
'note.todo_completed',
|
|
'note.user_updated_time',
|
|
'note.title',
|
|
],
|
|
],
|
|
])('should drop columns', (columns, header, insertAt, expected) => {
|
|
const actual = dropHeaderAt(columns, header, insertAt as InsertAt).map(c => c.name);
|
|
expect(actual).toEqual(expected);
|
|
});
|
|
|
|
});
|