mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-01-05 20:39:49 -06:00
fix(search): limit from UI not applied (closes #920)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// but we access properties like "subExpressions" which is not defined in the "Expression" class.
|
||||
|
||||
import Expression from "../../src/services/search/expressions/expression.js";
|
||||
import OrderByAndLimitExp from "../../src/services/search/expressions/order_by_and_limit.js";
|
||||
import SearchContext from "../../src/services/search/search_context.js";
|
||||
import parse from "../../src/services/search/services/parse.js";
|
||||
|
||||
@@ -244,6 +245,21 @@ describe("Parser", () => {
|
||||
expect(thirdSub.constructor.name).toEqual("AttributeExistsExp");
|
||||
expect(thirdSub.attributeName).toEqual("fourth");
|
||||
});
|
||||
|
||||
it("parses limit without order by", () => {
|
||||
const rootExp = parse({
|
||||
fulltextTokens: tokens(["hello", "hi"]),
|
||||
expressionTokens: [],
|
||||
searchContext: new SearchContext({
|
||||
excludeArchived: true,
|
||||
limit: 2
|
||||
})
|
||||
});
|
||||
|
||||
expect(rootExp).toBeInstanceOf(OrderByAndLimitExp);
|
||||
expect(rootExp.limit).toBe(2);
|
||||
expect(rootExp.subExpression).toBeInstanceOf(AndExp);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Invalid expressions", () => {
|
||||
|
||||
Reference in New Issue
Block a user