You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"group by function const date = task.due; if (!date.moment) { return "Undated"; } if (date.moment.day() === 0) { return date.format("[%%][8][%%]dddd"); } return date.format("[%%]d[%%]dddd");
251
+
"group by function \\
252
+
const date = task.due; \\
253
+
if (!date.moment) { \\
254
+
return "Undated"; \\
255
+
} \\
256
+
if (date.moment.day() === 0) { \\
257
+
{{! Put the Sunday group last: }} \\
258
+
return date.format("[%%][8][%%]dddd"); \\
259
+
} \\
260
+
return date.format("[%%]d[%%]dddd");
261
+
=>
262
+
group by function const date = task.due; if (!date.moment) { return "Undated"; } if (date.moment.day() === 0) { {{! Put the Sunday group last: }} return date.format("[%%][8][%%]dddd"); } return date.format("[%%]d[%%]dddd"); =>
263
+
group by function const date = task.due; if (!date.moment) { return "Undated"; } if (date.moment.day() === 0) { return date.format("[%%][8][%%]dddd"); } return date.format("[%%]d[%%]dddd");
205
264
"
206
265
`);
266
+
expect(query.grouping[0].instruction).toEqual(
267
+
'group by function const date = task.due; if (!date.moment) { return "Undated"; } if (date.moment.day() === 0) { return date.format("[%%][8][%%]dddd"); } return date.format("[%%]d[%%]dddd");',
268
+
);
207
269
});
208
270
});
209
271
210
272
describe('explain sorters',()=>{
211
273
it('should explain "sort by" options',()=>{
212
274
constsource='sort by due\nsort by priority()';
213
275
constquery=newQuery(source);
276
+
// This shows the accidental presence of stray () characters after 'sort by priority'.
277
+
// They are not *required* in the explanation, but are retained here to help in user support
278
+
// when I ask users to supply an explanation of their query.
"sort by function const priorities = [..."🟥🟧🟨🟩🟦"]; for (let i = 0; i < priorities.length; i++) { if (task.description.includes(priorities[i])) return i; } return 999;
299
+
"sort by function \\
300
+
const priorities = [..."🟥🟧🟨🟩🟦"]; \\
301
+
for (let i = 0; i < priorities.length; i++) { \\
302
+
if (task.description.includes(priorities[i])) return i; \\
303
+
} \\
304
+
return 999;
305
+
=>
306
+
sort by function const priorities = [..."🟥🟧🟨🟩🟦"]; for (let i = 0; i < priorities.length; i++) { if (task.description.includes(priorities[i])) return i; } return 999;
235
307
"
236
308
`);
309
+
expect(query.sorting[0].instruction).toEqual(
310
+
'sort by function const priorities = [..."🟥🟧🟨🟩🟦"]; for (let i = 0; i < priorities.length; i++) { if (task.description.includes(priorities[i])) return i; } return 999;',
0 commit comments