summaryrefslogtreecommitdiff
path: root/tests/parser.spec.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-01-21 16:12:43 +0530
committerAkshay Nair <phenax5@gmail.com>2024-01-21 16:12:43 +0530
commitc7a137861494edd65d0c8de76ab09f422ab15481 (patch)
tree0aaed5755228ed38cde3ac63dfd8701e7d7442a1 /tests/parser.spec.ts
parentf7a4596469d0652f868cad2d97a9edf92f4bc4c7 (diff)
downloadcss-everything-c7a137861494edd65d0c8de76ab09f422ab15481.tar.gz
css-everything-c7a137861494edd65d0c8de76ab09f422ab15481.zip
feat(eval): adds evaluation for simple binop expressions
Diffstat (limited to '')
-rw-r--r--tests/parser.spec.ts18
1 files changed, 18 insertions, 0 deletions
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')],
+ }),
+ }),
+ ],
+ }),
+ ])
+ })
})
})