feat: add note width modes
This commit is contained in:
@@ -10,6 +10,7 @@ describe('frontmatterOps system metadata', () => {
|
||||
['order', 4, { order: 4 }],
|
||||
['_sort', 'title:asc', { sort: 'title:asc' }],
|
||||
['sort', 'title:asc', { sort: 'title:asc' }],
|
||||
['_width', 'wide', { noteWidth: 'wide' }],
|
||||
['_sidebar_label', 'Projects', { sidebarLabel: 'Projects' }],
|
||||
['sidebar label', 'Projects', { sidebarLabel: 'Projects' }],
|
||||
] as [string, unknown, Partial<VaultEntry>][])('maps %s to the expected entry field', (key, value, expected) => {
|
||||
@@ -21,11 +22,12 @@ describe('frontmatterOps system metadata', () => {
|
||||
expect(frontmatterToEntryPatch('delete', '_sidebar_label').patch).toEqual({ sidebarLabel: null })
|
||||
expect(frontmatterToEntryPatch('delete', '_order').patch).toEqual({ order: null })
|
||||
expect(frontmatterToEntryPatch('delete', '_sort').patch).toEqual({ sort: null })
|
||||
expect(frontmatterToEntryPatch('delete', '_width').patch).toEqual({ noteWidth: null })
|
||||
})
|
||||
|
||||
it('keeps canonical system metadata out of custom properties', () => {
|
||||
const patch = contentToEntryPatch(
|
||||
'---\ntype: Type\n_icon: rocket\n_order: 4\n_sidebar_label: Projects\n_sort: title:asc\n_internal: secret\nOwner: Luca\n---\n# Project\n',
|
||||
'---\ntype: Type\n_icon: rocket\n_order: 4\n_sidebar_label: Projects\n_sort: title:asc\n_width: wide\n_internal: secret\nOwner: Luca\n---\n# Project\n',
|
||||
)
|
||||
|
||||
expect(patch).toEqual({
|
||||
@@ -34,7 +36,16 @@ describe('frontmatterOps system metadata', () => {
|
||||
order: 4,
|
||||
sidebarLabel: 'Projects',
|
||||
sort: 'title:asc',
|
||||
noteWidth: 'wide',
|
||||
properties: { Owner: 'Luca' },
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps bare width as a custom property', () => {
|
||||
const patch = contentToEntryPatch('---\nwidth: 320\n---\n# Project\n')
|
||||
|
||||
expect(patch).toEqual({
|
||||
properties: { width: 320 },
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user