generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3221 from obsidian-tasks-group/explain-grouping-a…
…nd-sorting feat: 'explain' shows effect of Line Continuations & Placeholders
- Loading branch information
Showing
7 changed files
with
191 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Grouper, type GrouperFunction } from '../../../src/Query/Group/Grouper'; | ||
import type { Task } from '../../../src/Task/Task'; | ||
import type { SearchInfo } from '../../../src/Query/SearchInfo'; | ||
import { Statement } from '../../../src/Query/Statement'; | ||
|
||
describe('Grouper', () => { | ||
const grouperFunction: GrouperFunction = (task: Task, _searchInfo: SearchInfo) => { | ||
return [task.lineNumber.toString()]; | ||
}; | ||
|
||
it('should supply the original instruction', () => { | ||
const grouper = new Grouper('group by lineNumber', 'lineNumber', grouperFunction, false); | ||
|
||
expect(grouper.instruction).toBe('group by lineNumber'); | ||
expect(grouper.statement.rawInstruction).toBe('group by lineNumber'); | ||
}); | ||
|
||
it('should store a Statement object', () => { | ||
const instruction = 'group by lineNumber'; | ||
const statement = new Statement(instruction, instruction); | ||
const grouper = new Grouper('group by lineNumber', 'lineNumber', grouperFunction, false); | ||
|
||
grouper.setStatement(statement); | ||
|
||
expect(grouper.statement.rawInstruction).toBe('group by lineNumber'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { type Comparator, Sorter } from '../../../src/Query/Sort/Sorter'; | ||
import type { Task } from '../../../src/Task/Task'; | ||
import type { SearchInfo } from '../../../src/Query/SearchInfo'; | ||
import { Statement } from '../../../src/Query/Statement'; | ||
|
||
describe('Sorter', () => { | ||
const comparator: Comparator = (a: Task, b: Task, _searchInfo: SearchInfo) => { | ||
return a.lineNumber - b.lineNumber; | ||
}; | ||
|
||
it('should supply the original instruction', () => { | ||
const sorter = new Sorter('sort by lineNumber', 'lineNumber', comparator, false); | ||
|
||
expect(sorter.instruction).toBe('sort by lineNumber'); | ||
expect(sorter.statement.rawInstruction).toBe('sort by lineNumber'); | ||
}); | ||
|
||
it('should store a Statement object', () => { | ||
const instruction = 'sort by lineNumber'; | ||
const statement = new Statement(instruction, instruction); | ||
const sorter = new Sorter('sort by lineNumber', 'lineNumber', comparator, false); | ||
|
||
sorter.setStatement(statement); | ||
|
||
expect(sorter.statement.rawInstruction).toBe('sort by lineNumber'); | ||
}); | ||
}); |