mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-19 00:00:43 +00:00
Fix bug with sortan operator called on date fields (#4839)
* Add failing unit test that shows the bug * Fix the bug
This commit is contained in:
@@ -685,6 +685,17 @@ function runTests(wiki) {
|
||||
expect(wiki.filterTiddlers("b a b c +[sortby[b a c b]]").join(",")).toBe("b,a,c");
|
||||
});
|
||||
|
||||
it("should handle the sortan operator", function() {
|
||||
expect(wiki.filterTiddlers("b a c +[sortan[]]").join(",")).toBe("a,b,c");
|
||||
expect(wiki.filterTiddlers("b2 a3 a1 b1 c2 a2 c3 b3 c1 +[sortan[]]").join(",")).toBe("a1,a2,a3,b1,b2,b3,c1,c2,c3");
|
||||
expect(wiki.filterTiddlers("b2 a10 c10 a1 b1 c2 a2 b10 c1 +[sortan[]]").join(",")).toBe("a1,a2,a10,b1,b2,b10,c1,c2,c10");
|
||||
expect(wiki.filterTiddlers("TiddlerOne $:/TiddlerTwo [[Tiddler Three]] +[sortan[]]").join(",")).toBe("$:/TiddlerTwo,Tiddler Three,TiddlerOne");
|
||||
});
|
||||
|
||||
it("should handle the sortan operator sorting on date fields", function() {
|
||||
expect(wiki.filterTiddlers("TiddlerOne $:/TiddlerTwo [[Tiddler Three]] +[sortan[modified]]").join(",")).toBe("$:/TiddlerTwo,TiddlerOne,Tiddler Three");
|
||||
});
|
||||
|
||||
it("should handle the slugify operator", function() {
|
||||
expect(wiki.filterTiddlers("[[Joe Bloggs]slugify[]]").join(",")).toBe("joe-bloggs");
|
||||
expect(wiki.filterTiddlers("[[Joe Bloggs2]slugify[]]").join(",")).toBe("joe-bloggs2");
|
||||
|
||||
Reference in New Issue
Block a user