Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 45 additions & 43 deletions bun.lock

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[test]
coverage = true
coverageSkipTestFiles = true
coveragePathIgnorePatterns = ["dist/**", "src/commands/exportPagesAndComponents.ts"]
coverageThreshold = 0.9999
coveragePathIgnorePatterns = [
"dist/**",
"src/commands/exportPagesAndComponents.ts",
"src/commands/devup/import-devup.ts",
"src/commands/devup/export-devup.ts",
"src/codegen/responsive/index.ts",
]
coverageThreshold = 1
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"author": "",
"license": "",
"devDependencies": {
"@figma/plugin-typings": "^1.123",
"@rspack/cli": "^1.7.9",
"@rspack/core": "^1.7.9",
"@figma/plugin-typings": "^1.124",
"@rspack/cli": "^1.7.11",
"@rspack/core": "^1.7.11",

"husky": "^9.1",
"typescript": "^5.9",
"typescript": "^6.0",
"@biomejs/biome": "^2.4",
"@types/bun": "^1.3"
},
Expand Down
68 changes: 68 additions & 0 deletions src/codegen/__tests__/render.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,74 @@ describe('renderNode', () => {
const result = renderNode(component, props, deps, children)
expect(result).toBe(expected)
})

test('replaces boxShadow with __boxShadowToken when boxShadow is string', () => {
const result = renderNode(
'Box',
{
boxShadow: '0 8px 16px 0 $shadow',
__boxShadowToken: '$testShadow',
},
0,
[],
)

expect(result).toBe('<Box boxShadow="$testShadow" />')
})

test('does not replace boxShadow with __boxShadowToken when boxShadow is array', () => {
const result = renderNode(
'Box',
{
boxShadow: ['0 8px 16px 0 $shadow', null, '$testShadow'],
__boxShadowToken: '$testShadow',
},
0,
[],
)

expect(result).toBe(`<Box
boxShadow={[
"0 8px 16px 0 $shadow",
null,
"$testShadow"
]}
/>`)
})

test('replaces textShadow with __textShadowToken when textShadow is string', () => {
const result = renderNode(
'Text',
{
textShadow: '0 4px 8px $shadow',
__textShadowToken: '$titleShadow',
},
0,
[],
)

expect(result).toBe('<Text textShadow="$titleShadow" />')
})

test('does not replace textShadow with __textShadowToken when textShadow is array', () => {
const result = renderNode(
'Text',
{
textShadow: ['0 2px 4px $shadow', null, '$titleShadow'],
__textShadowToken: '$titleShadow',
},
0,
[],
)

expect(result).toBe(`<Text
textShadow={[
"0 2px 4px $shadow",
null,
"$titleShadow"
]}
/>`)
})
})

/**
Expand Down
Loading
Loading