Skip to content

Commit c347144

Browse files
committed
refactor: Add accessor for Grouper objects in TaskGroups
1 parent 53f6459 commit c347144

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Query/TaskGroups.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ export class TaskGroups {
3333
this.addTasks(taskGroupingTree);
3434
}
3535

36+
/**
37+
* Return the {@link Grouper} objects, 1 per 'group by' line in the tasks query block.
38+
*/
39+
public get groupers(): Grouper[] {
40+
return this._groupers;
41+
}
42+
3643
/**
3744
* All the tasks matching the query, grouped together, and in the order
3845
* that they should be displayed.

tests/TaskGroups.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('Grouping tasks', () => {
2929
const groups = new TaskGroups(grouping, inputs);
3030

3131
// Assert
32+
expect(groups.groupers).toStrictEqual(grouping);
3233
expect(groups.toString()).toMatchInlineSnapshot(`
3334
"
3435
Group names: [file1]

0 commit comments

Comments
 (0)