From c7a137861494edd65d0c8de76ab09f422ab15481 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 21 Jan 2024 16:12:43 +0530 Subject: feat(eval): adds evaluation for simple binop expressions --- tests/parser.spec.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/parser.spec.ts') diff --git a/tests/parser.spec.ts b/tests/parser.spec.ts index 494bb51..16480e6 100644 --- a/tests/parser.spec.ts +++ b/tests/parser.spec.ts @@ -267,5 +267,23 @@ describe('parser', () => { }), ]) }) + + it('parses calc expression with vars', () => { + expect(parse(`calc(5px * var(--value))`)).toEqual([ + Expr.Call({ + name: 'calc', + args: [ + Expr.BinOp({ + op: '*', + left: Expr.LiteralNumber({ value: 5, unit: 'px' }), + right: Expr.Call({ + name: 'var', + args: [Expr.VarIdentifier('--value')], + }), + }), + ], + }), + ]) + }) }) }) -- cgit v1.3.1