Skip to content

Commit 9d95762

Browse files
committed
test: - Add a new docs example, showing floating-point group names
1 parent db5a714 commit 9d95762

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.other_properties_task.urgency_docs.approved.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,14 @@ group by function task.urgency.toFixed(3)
77

88
- Show the urgency to 3 decimal places, unlike the built-in "group by urgency" which uses 2.
99

10+
```javascript
11+
group by function task.urgency
12+
```
13+
14+
- Show non-integer urgency values to 5 decimal places, and integer ones to 0 decimal places.
15+
- Sorting of groups by name has been found to be unreliable with varying numbers of decimal places.
16+
- So to ensure consistent sorting, Tasks will round non-integer numbers to a fixed 5 decimal places, returning the value as a string.
17+
- This still sorts consistently even when some of the group's values are integers.
18+
1019

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

tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.other_properties_task.urgency_results.approved.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,18 @@ Show the urgency to 3 decimal places, unlike the built-in "group by urgency" whi
1313
9.000
1414
====================================================================================
1515

16+
17+
group by function task.urgency
18+
Show non-integer urgency values to 5 decimal places, and integer ones to 0 decimal places.
19+
Sorting of groups by name has been found to be unreliable with varying numbers of decimal places.
20+
So to ensure consistent sorting, Tasks will round non-integer numbers to a fixed 5 decimal places, returning the value as a string.
21+
This still sorts consistently even when some of the group's values are integers.
22+
=>
23+
-1.80000
24+
0
25+
1.95000
26+
3.90000
27+
6
28+
9
29+
====================================================================================
30+

tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,13 @@ describe('other properties', () => {
704704
'group by function task.urgency.toFixed(3)',
705705
'Show the urgency to 3 decimal places, unlike the built-in "group by urgency" which uses 2',
706706
],
707+
[
708+
'group by function task.urgency',
709+
'Show non-integer urgency values to 5 decimal places, and integer ones to 0 decimal places',
710+
'Sorting of groups by name has been found to be unreliable with varying numbers of decimal places.',
711+
'So to ensure consistent sorting, Tasks will round non-integer numbers to a fixed 5 decimal places, returning the value as a string.',
712+
"This still sorts consistently even when some of the group's values are integers.",
713+
],
707714
],
708715
SampleTasks.withAllPriorities(),
709716
],

0 commit comments

Comments
 (0)