1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-04 17:16:18 +00:00

Add explicit test for empty result when no filter passes

This commit is contained in:
jeremy@jermolene.com 2021-11-04 17:36:02 +00:00
parent b47a3ab585
commit ee32eb909f

View File

@ -291,12 +291,12 @@ describe("'reduce' and 'intersection' filter prefix tests", function() {
wiki.addTiddler({
title: "$:/filter1",
text: "[tag[cakes]then[It is customary]]",
tags: "$:/tags/Filter"
tags: "$:/tags/Filter $:/tags/SecondFilter"
});
wiki.addTiddler({
title: "$:/filter2",
text: "[<currentTiddler>tag[shopping]then[It is not customary]]",
tags: "$:/tags/Filter"
tags: "$:/tags/Filter $:/tags/SecondFilter"
});
wiki.addTiddler({
title: "$:/filter3",
@ -307,11 +307,18 @@ describe("'reduce' and 'intersection' filter prefix tests", function() {
title: "$:/tags/Filter",
list: "$:/filter1 $:/filter2 $:/filter3"
});
wiki.addTiddler({
title: "$:/tags/SecondFilter",
list: "$:/filter1 $:/filter2"
});
it("should handle the :cascade filter prefix", function() {
expect(wiki.filterTiddlers("[[Rice Pudding]] :cascade[all[shadows+tiddlers]tag[$:/tags/Filter]get[text]]").join(",")).toBe("It is not customary");
expect(wiki.filterTiddlers("[[chocolate cake]] :cascade[all[shadows+tiddlers]tag[$:/tags/Filter]get[text]]").join(",")).toBe("It is customary");
expect(wiki.filterTiddlers("[[Sparkling water]] :cascade[all[shadows+tiddlers]tag[$:/tags/Filter]get[text]]").join(",")).toBe("Just a default");
expect(wiki.filterTiddlers("[[Rice Pudding]] :cascade[all[shadows+tiddlers]tag[$:/tags/SecondFilter]get[text]]").join(",")).toBe("It is not customary");
expect(wiki.filterTiddlers("[[chocolate cake]] :cascade[all[shadows+tiddlers]tag[$:/tags/SecondFilter]get[text]]").join(",")).toBe("It is customary");
expect(wiki.filterTiddlers("[[Sparkling water]] :cascade[all[shadows+tiddlers]tag[$:/tags/SecondFilter]get[text]]").join(",")).toBe("");
});
it("should handle the :reduce filter prefix", function() {