Skip to content

Commit a9d25f5

Browse files
committed
test: Create docs for task properties isBlocked() and isBlocking()
Both need the argument query.allTasks.
1 parent 7a8a85d commit a9d25f5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/Scripting/TaskProperties.test.task_dependency_fields.approved.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
| ----- | ----- | ----- | ----- | ----- |
55
| `task.id` | `string` | `'abcdef'` | `string` | `''` |
66
| `task.blockedBy` | `string[]` | `['123456', 'abc123']` | `any[]` | `[]` |
7+
| `task.isBlocked(query.allTasks)` | `boolean` | `false` | `boolean` | `false` |
8+
| `task.isBlocking(query.allTasks)` | `boolean` | `false` | `boolean` | `false` |
79

810

911
<!-- placeholder to force blank line after included text -->

tests/Scripting/TaskProperties.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { TaskBuilder } from '../TestingTools/TaskBuilder';
99
import { verifyMarkdownForDocs } from '../TestingTools/VerifyMarkdown';
1010
import { parseAndEvaluateExpression } from '../../src/Scripting/TaskExpression';
1111
import { MarkdownTable } from '../../src/lib/MarkdownTable';
12+
import { makeQueryContextWithTasks } from '../../src/Scripting/QueryContext';
1213
import { addBackticks, determineExpressionType, formatToRepresentType } from './ScriptingTestHelpers';
1314

1415
window.moment = moment;
@@ -20,9 +21,10 @@ describe('task', () => {
2021
const markdownTable = new MarkdownTable(['Field', 'Type 1', 'Example 1', 'Type 2', 'Example 2']);
2122
const task1 = TaskBuilder.createFullyPopulatedTask();
2223
const task2 = new TaskBuilder().description('minimal task').status(Status.makeInProgress()).build();
24+
const queryContext = makeQueryContextWithTasks(task1.path, [task1, task2]);
2325
for (const field of fields) {
24-
const value1 = parseAndEvaluateExpression(task1, field, undefined);
25-
const value2 = parseAndEvaluateExpression(task2, field, undefined);
26+
const value1 = parseAndEvaluateExpression(task1, field, queryContext);
27+
const value2 = parseAndEvaluateExpression(task2, field, queryContext);
2628
const cells = [
2729
addBackticks(field),
2830
addBackticks(determineExpressionType(value1)),
@@ -96,6 +98,8 @@ describe('task', () => {
9698
// force line break
9799
'task.id',
98100
'task.blockedBy',
101+
'task.isBlocked(query.allTasks)',
102+
'task.isBlocking(query.allTasks)',
99103
]);
100104
});
101105

0 commit comments

Comments
 (0)