Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "progress-tracker-label",
"name": "Progress Tracker",
"version": "1.6.5",
"version": "1.6.6",
"minAppVersion": "0.15.0",
"description": "Obsidian plugin that displays progress statistics inline by calculating the ratio of completed to incomplete tasks within task trees. It includes tasks from both the current note and any linked notes, offering insights like Complete 10% (10/100). Designed to integrate seamlessly via markdown post-processing, it avoids automatic parent task completion for full user control.",
"author": "BalaSoft",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "progress-tracker-label",
"version": "1.6.5",
"version": "1.6.6",
"description": "Progress Tracker plugin for Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {
Expand Down
58 changes: 58 additions & 0 deletions tests/bug-linked-parent-with-children.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import * as fs from 'fs';
import * as path from 'path';
import { updateParentStatuses } from '../src/auto-parent';

describe('Parent task with link and child tasks', () => {
const root = path.join(__dirname, 'fixtures');

test('parent with link to incomplete page and all children complete should remain unchecked', () => {
// Scenario: parent task links to pageB (which has incomplete tasks)
// and has two child tasks that are both complete.
// Expected: parent should remain unchecked because linked page has incomplete tasks
const filePath = path.join(root, 'pageA.md');

const content = `- [ ] [[pageB]]
- [x] child A
- [x] child B`;

const result = updateParentStatuses(content, undefined, filePath, root, 'ignoretasktree', true);

// Parent should remain unchecked despite all children being complete
// because pageB has incomplete tasks
expect(result.content.split(/\r?\n/)[0]).toBe('- [ ] [[pageB]]');
expect(result.content).toBe(content); // No changes should be made
});

test('parent with link to complete page and all children complete should be checked', () => {
// Scenario: parent task links to a page with all tasks complete
// and has two child tasks that are both complete.
// Expected: parent should be checked
const filePath = path.join(root, 'pageA-complete.md');

const content = `- [ ] [[subpage-complete]]
- [x] child A
- [x] child B`;

const result = updateParentStatuses(content, undefined, filePath, root, 'ignoretasktree', true);

// Parent should be checked because both children and linked page are complete
expect(result.content.split(/\r?\n/)[0]).toBe('- [x] [[subpage-complete]]');
});

test('parent with link and incomplete children should remain unchecked', () => {
// Scenario: parent task has a link (doesn't matter if page is complete)
// but has at least one incomplete child
// Expected: parent should remain unchecked
const filePath = path.join(root, 'pageA.md');

const content = `- [ ] [[subpage-complete]]
- [x] child A
- [ ] child B`;

const result = updateParentStatuses(content, undefined, filePath, root, 'ignoretasktree', true);

// Parent should remain unchecked because child B is incomplete
expect(result.content.split(/\r?\n/)[0]).toBe('- [ ] [[subpage-complete]]');
expect(result.content).toBe(content); // No changes should be made
});
});
3 changes: 3 additions & 0 deletions tests/fixtures/pageA-complete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [ ] [[subpage-complete]]
- [x] child A
- [x] child B
3 changes: 3 additions & 0 deletions tests/fixtures/pageA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [ ] [[pageB]]
- [x] child A
- [ ] child B
1 change: 1 addition & 0 deletions tests/fixtures/pageB.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [ ] task
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"1.0.0": "0.15.0"
"1.0.0": "0.15.0",
"1.6.6": "0.15.0"
}