Skip to content

Commit a939c79

Browse files
committed
Add JS API test
1 parent 0addc6a commit a939c79

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/index.test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { equal, throws } from 'node:assert/strict'
1+
import { deepEqual, equal, throws } from 'node:assert/strict'
22
import { test } from 'node:test'
33
import postcss from 'postcss'
44

5-
import plugin from '../index.js'
5+
import plugin, { renderShadows } from '../index.js'
66

77
function run(input, output, opts) {
88
let result = postcss([plugin(opts)]).process(input, { from: undefined })
@@ -18,6 +18,13 @@ test('replaces sharp-shadow function', () => {
1818
)
1919
})
2020

21+
test('has JS API', () => {
22+
deepEqual(renderShadows('sharp', false, '2px', '4px', '10px', 'red'), [
23+
'calc(0.25 * 2px) calc(0.25 * 4px) calc(0.25 * 10px) rgb(from red r g b / calc(alpha * 1))',
24+
'calc(1 * 2px) calc(1 * 4px) calc(1 * 10px) rgb(from red r g b / calc(alpha * 0.5))'
25+
])
26+
})
27+
2128
test('replaces soft-shadow function', () => {
2229
run(
2330
'a { box-shadow: --soft-shadow(1px 2px 12px blue); }',

0 commit comments

Comments
 (0)