diff --git a/docs/Quick Reference.md b/docs/Quick Reference.md index a99693f554..2d1adadecb 100644 --- a/docs/Quick Reference.md +++ b/docs/Quick Reference.md @@ -21,8 +21,8 @@ This table summarizes the filters and other options available inside a `tasks` b | **[[Task Dependencies]]** | | | | | | `id (includes, does not include) `
`id (regex matches, regex does not match) /regex/i`
`has id`
`no id` | `sort by id` | `group by id` | `hide id` | `task.id` | | `has blocked by`
`no blocked by` | | | `hide depends on` | `task.blockedBy` | -| `is blocked`
`is not blocked` | | | | | -| `is blocking`
`is not blocking` | | | | | +| `is blocked`
`is not blocked` | | | | `task.isBlocked(query.allTasks)` | +| `is blocking`
`is not blocking` | | | | `task.isBlocking(query.allTasks)` | | **[[Filters#Filters for Dates in Tasks\|Dates]]** | | | | | | `done (on, before, after, on or before, on or after) `
`done (in, before, after, in or before, in or after) ...`
`... YYYY-MM-DD YYYY-MM-DD`
`... (last, this, next) (week, month, quarter, year)`
`... (YYYY-Www,YYYY-mm, YYYY-Qq, YYYY)`
`has done date`
`no done date`
`done date is invalid` | `sort by done` | `group by done` | `hide done date` | `task.done` | | `created (on, before, after, on or before, on or after) `
`created (in, before, after, in or before, in or after) ...`
`... YYYY-MM-DD YYYY-MM-DD`
`... (last, this, next) (week, month, quarter, year)`
`... (YYYY-Www,YYYY-mm, YYYY-Qq, YYYY)`
`has created date`
`no created date`
`created date is invalid` | `sort by created` | `group by created` | `hide created date` | `task.created` | diff --git a/docs/Scripting/Task Properties.md b/docs/Scripting/Task Properties.md index 7583999f94..92934174ac 100644 --- a/docs/Scripting/Task Properties.md +++ b/docs/Scripting/Task Properties.md @@ -121,10 +121,14 @@ For more information, including adding your own customised statuses, see [[Statu | ----- | ----- | ----- | ----- | ----- | | `task.id` | `string` | `'abcdef'` | `string` | `''` | | `task.blockedBy` | `string[]` | `['123456', 'abc123']` | `any[]` | `[]` | +| `task.isBlocked(query.allTasks)` | `boolean` | `false` | `boolean` | `false` | +| `task.isBlocking(query.allTasks)` | `boolean` | `false` | `boolean` | `false` | 1. See the page [[Task Dependencies]], which explains the dependencies facility. +1. `Task.isBlocked()` behaves the same as `is blocked`: see [[Filters#Blocked Tasks]]. +1. `Task.isBlocking()` behaves the same as `is blocking`: see [[Filters#Blocking Tasks]]. 1. Task Dependencies were released in Tasks X.Y.Z. ## Values for Other Task Properties diff --git a/tests/Scripting/TaskProperties.test.task_dependency_fields.approved.md b/tests/Scripting/TaskProperties.test.task_dependency_fields.approved.md index d02e7d038f..4fff6e89ac 100644 --- a/tests/Scripting/TaskProperties.test.task_dependency_fields.approved.md +++ b/tests/Scripting/TaskProperties.test.task_dependency_fields.approved.md @@ -4,6 +4,8 @@ | ----- | ----- | ----- | ----- | ----- | | `task.id` | `string` | `'abcdef'` | `string` | `''` | | `task.blockedBy` | `string[]` | `['123456', 'abc123']` | `any[]` | `[]` | +| `task.isBlocked(query.allTasks)` | `boolean` | `false` | `boolean` | `false` | +| `task.isBlocking(query.allTasks)` | `boolean` | `false` | `boolean` | `false` | diff --git a/tests/Scripting/TaskProperties.test.ts b/tests/Scripting/TaskProperties.test.ts index 79eb75e7cc..2b7ff062f1 100644 --- a/tests/Scripting/TaskProperties.test.ts +++ b/tests/Scripting/TaskProperties.test.ts @@ -9,6 +9,7 @@ import { TaskBuilder } from '../TestingTools/TaskBuilder'; import { verifyMarkdownForDocs } from '../TestingTools/VerifyMarkdown'; import { parseAndEvaluateExpression } from '../../src/Scripting/TaskExpression'; import { MarkdownTable } from '../../src/lib/MarkdownTable'; +import { makeQueryContextWithTasks } from '../../src/Scripting/QueryContext'; import { addBackticks, determineExpressionType, formatToRepresentType } from './ScriptingTestHelpers'; window.moment = moment; @@ -20,9 +21,10 @@ describe('task', () => { const markdownTable = new MarkdownTable(['Field', 'Type 1', 'Example 1', 'Type 2', 'Example 2']); const task1 = TaskBuilder.createFullyPopulatedTask(); const task2 = new TaskBuilder().description('minimal task').status(Status.makeInProgress()).build(); + const queryContext = makeQueryContextWithTasks(task1.path, [task1, task2]); for (const field of fields) { - const value1 = parseAndEvaluateExpression(task1, field, undefined); - const value2 = parseAndEvaluateExpression(task2, field, undefined); + const value1 = parseAndEvaluateExpression(task1, field, queryContext); + const value2 = parseAndEvaluateExpression(task2, field, queryContext); const cells = [ addBackticks(field), addBackticks(determineExpressionType(value1)), @@ -96,6 +98,8 @@ describe('task', () => { // force line break 'task.id', 'task.blockedBy', + 'task.isBlocked(query.allTasks)', + 'task.isBlocking(query.allTasks)', ]); });