mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
commit
e57148b034
@ -28,7 +28,7 @@ exports.limit = function(source,operator,options) {
|
||||
// Slice the array if necessary
|
||||
var limit = Math.min(source.length,parseInt(operator.operand,10));
|
||||
if(operator.prefix === "!") {
|
||||
results = source.slice(source.length - limit,limit);
|
||||
results = source.slice(source.length - limit);
|
||||
} else {
|
||||
results = source.slice(0,limit);
|
||||
}
|
||||
|
@ -141,6 +141,7 @@ describe("Filter tests", function() {
|
||||
it("should handle the limit operator", function() {
|
||||
expect(wiki.filterTiddlers("[!is[system]sort[title]limit[2]]").join(",")).toBe("a fourth tiddler,one");
|
||||
expect(wiki.filterTiddlers("[prefix[Tid]sort[title]limit[1]]").join(",")).toBe("Tiddler Three");
|
||||
expect(wiki.filterTiddlers("[prefix[Tid]sort[title]!limit[1]]").join(",")).toBe("TiddlerOne");
|
||||
});
|
||||
|
||||
it("should handle the list operator", function() {
|
||||
|
Loading…
Reference in New Issue
Block a user