mirror of
https://github.com/zadam/trilium.git
synced 2025-10-31 18:36:30 +01:00
shortcut negation syntax
This commit is contained in:
@@ -21,13 +21,16 @@ describe("Parser", () => {
|
||||
});
|
||||
|
||||
expect(rootExp.constructor.name).toEqual("OrExp");
|
||||
const [firstSub, secondSub] = rootExp.subExpressions;
|
||||
const subs = rootExp.subExpressions;
|
||||
|
||||
expect(firstSub.constructor.name).toEqual("NoteCacheFulltextExp");
|
||||
expect(firstSub.tokens).toEqual(["hello", "hi"]);
|
||||
expect(subs[0].constructor.name).toEqual("NoteCacheFulltextExp");
|
||||
expect(subs[0].tokens).toEqual(["hello", "hi"]);
|
||||
|
||||
expect(secondSub.constructor.name).toEqual("NoteContentFulltextExp");
|
||||
expect(secondSub.tokens).toEqual(["hello", "hi"]);
|
||||
expect(subs[1].constructor.name).toEqual("NoteContentProtectedFulltextExp");
|
||||
expect(subs[1].tokens).toEqual(["hello", "hi"]);
|
||||
|
||||
expect(subs[2].constructor.name).toEqual("NoteContentUnprotectedFulltextExp");
|
||||
expect(subs[2].tokens).toEqual(["hello", "hi"]);
|
||||
});
|
||||
|
||||
it("simple label comparison", () => {
|
||||
@@ -43,6 +46,30 @@ describe("Parser", () => {
|
||||
expect(rootExp.comparator).toBeTruthy();
|
||||
});
|
||||
|
||||
it("simple attribute negation", () => {
|
||||
let rootExp = parser({
|
||||
fulltextTokens: [],
|
||||
expressionTokens: ["#!mylabel"],
|
||||
parsingContext: new ParsingContext()
|
||||
});
|
||||
|
||||
expect(rootExp.constructor.name).toEqual("NotExp");
|
||||
expect(rootExp.subExpression.constructor.name).toEqual("AttributeExistsExp");
|
||||
expect(rootExp.subExpression.attributeType).toEqual("label");
|
||||
expect(rootExp.subExpression.attributeName).toEqual("mylabel");
|
||||
|
||||
rootExp = parser({
|
||||
fulltextTokens: [],
|
||||
expressionTokens: ["~!myrelation"],
|
||||
parsingContext: new ParsingContext()
|
||||
});
|
||||
|
||||
expect(rootExp.constructor.name).toEqual("NotExp");
|
||||
expect(rootExp.subExpression.constructor.name).toEqual("AttributeExistsExp");
|
||||
expect(rootExp.subExpression.attributeType).toEqual("relation");
|
||||
expect(rootExp.subExpression.attributeName).toEqual("myrelation");
|
||||
});
|
||||
|
||||
it("simple label AND", () => {
|
||||
const rootExp = parser({
|
||||
fulltextTokens: [],
|
||||
|
||||
Reference in New Issue
Block a user