Merge branch 'master' into 74-integration-with-bookmarks-core-plugin
# Conflicts: # src/custom-sort/custom-sort.spec.ts # src/custom-sort/custom-sort.ts
This commit is contained in:
commit
eed3a65f08
|
@ -2261,25 +2261,6 @@ describe('CustomSortOrder.byMetadataFieldAlphabeticalReverse', () => {
|
||||||
expect(result2).toBe(SORT_FIRST_GOES_LATER)
|
expect(result2).toBe(SORT_FIRST_GOES_LATER)
|
||||||
expect(result3).toBe(SORT_ITEMS_ARE_EQUAL)
|
expect(result3).toBe(SORT_ITEMS_ARE_EQUAL)
|
||||||
})
|
})
|
||||||
it('should put the item with metadata below the second one w/o metadata (this is reverse order)', () => {
|
|
||||||
// given
|
|
||||||
const itemA: Partial<FolderItemForSorting> = {
|
|
||||||
metadataFieldValue: '15',
|
|
||||||
sortString: 'n123'
|
|
||||||
}
|
|
||||||
const itemB: Partial<FolderItemForSorting> = {
|
|
||||||
sortString: 'n123'
|
|
||||||
}
|
|
||||||
const sorter: SorterFn = getSorterFnFor(CustomSortOrder.byMetadataFieldAlphabetical)
|
|
||||||
|
|
||||||
// when
|
|
||||||
const result1: number = sorter(itemA as FolderItemForSorting, itemB as FolderItemForSorting)
|
|
||||||
const result2: number = sorter(itemB as FolderItemForSorting, itemA as FolderItemForSorting)
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(result1).toBe(SORT_FIRST_GOES_LATER)
|
|
||||||
expect(result2).toBe(SORT_FIRST_GOES_EARLIER)
|
|
||||||
})
|
|
||||||
it('should put the item with metadata later if the second one has no metadata (reverse order)', () => {
|
it('should put the item with metadata later if the second one has no metadata (reverse order)', () => {
|
||||||
// given
|
// given
|
||||||
const itemA: Partial<FolderItemForSorting> = {
|
const itemA: Partial<FolderItemForSorting> = {
|
||||||
|
|
|
@ -42,6 +42,15 @@ export interface ProcessingContext {
|
||||||
iconFolderPluginInstance?: ObsidianIconFolder_PluginInstance
|
iconFolderPluginInstance?: ObsidianIconFolder_PluginInstance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProcessingContext {
|
||||||
|
// For internal transient use
|
||||||
|
plugin?: Plugin // to hand over the access to App instance to the sorting engine
|
||||||
|
_mCache?: MetadataCache
|
||||||
|
starredPluginInstance?: Starred_PluginInstance
|
||||||
|
|
||||||
|
iconFolderPluginInstance?: ObsidianIconFolder_PluginInstance
|
||||||
|
}
|
||||||
|
|
||||||
let CollatorCompare = new Intl.Collator(undefined, {
|
let CollatorCompare = new Intl.Collator(undefined, {
|
||||||
usage: "sort",
|
usage: "sort",
|
||||||
sensitivity: "base",
|
sensitivity: "base",
|
||||||
|
|
Loading…
Reference in New Issue