Skip to content

Commit 0c2dcc7

Browse files
authored
Merge pull request #42 from dev-five-git/support-variable
Support variable
2 parents 8a453ab + 7da3ef0 commit 0c2dcc7

30 files changed

+2878
-195
lines changed

bun.lock

Lines changed: 45 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bunfig.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
[test]
22
coverage = true
33
coverageSkipTestFiles = true
4-
coveragePathIgnorePatterns = ["dist/**", "src/commands/exportPagesAndComponents.ts"]
5-
coverageThreshold = 0.9999
4+
coveragePathIgnorePatterns = [
5+
"dist/**",
6+
"src/commands/exportPagesAndComponents.ts",
7+
"src/commands/devup/import-devup.ts",
8+
"src/commands/devup/export-devup.ts",
9+
"src/codegen/responsive/index.ts",
10+
]
11+
coverageThreshold = 1

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
"author": "",
1616
"license": "",
1717
"devDependencies": {
18-
"@figma/plugin-typings": "^1.123",
19-
"@rspack/cli": "^1.7.9",
20-
"@rspack/core": "^1.7.9",
18+
"@figma/plugin-typings": "^1.124",
19+
"@rspack/cli": "^1.7.11",
20+
"@rspack/core": "^1.7.11",
2121

2222
"husky": "^9.1",
23-
"typescript": "^5.9",
23+
"typescript": "^6.0",
2424
"@biomejs/biome": "^2.4",
2525
"@types/bun": "^1.3"
2626
},

src/codegen/__tests__/render.test.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,74 @@ describe('renderNode', () => {
3535
const result = renderNode(component, props, deps, children)
3636
expect(result).toBe(expected)
3737
})
38+
39+
test('replaces boxShadow with __boxShadowToken when boxShadow is string', () => {
40+
const result = renderNode(
41+
'Box',
42+
{
43+
boxShadow: '0 8px 16px 0 $shadow',
44+
__boxShadowToken: '$testShadow',
45+
},
46+
0,
47+
[],
48+
)
49+
50+
expect(result).toBe('<Box boxShadow="$testShadow" />')
51+
})
52+
53+
test('does not replace boxShadow with __boxShadowToken when boxShadow is array', () => {
54+
const result = renderNode(
55+
'Box',
56+
{
57+
boxShadow: ['0 8px 16px 0 $shadow', null, '$testShadow'],
58+
__boxShadowToken: '$testShadow',
59+
},
60+
0,
61+
[],
62+
)
63+
64+
expect(result).toBe(`<Box
65+
boxShadow={[
66+
"0 8px 16px 0 $shadow",
67+
null,
68+
"$testShadow"
69+
]}
70+
/>`)
71+
})
72+
73+
test('replaces textShadow with __textShadowToken when textShadow is string', () => {
74+
const result = renderNode(
75+
'Text',
76+
{
77+
textShadow: '0 4px 8px $shadow',
78+
__textShadowToken: '$titleShadow',
79+
},
80+
0,
81+
[],
82+
)
83+
84+
expect(result).toBe('<Text textShadow="$titleShadow" />')
85+
})
86+
87+
test('does not replace textShadow with __textShadowToken when textShadow is array', () => {
88+
const result = renderNode(
89+
'Text',
90+
{
91+
textShadow: ['0 2px 4px $shadow', null, '$titleShadow'],
92+
__textShadowToken: '$titleShadow',
93+
},
94+
0,
95+
[],
96+
)
97+
98+
expect(result).toBe(`<Text
99+
textShadow={[
100+
"0 2px 4px $shadow",
101+
null,
102+
"$titleShadow"
103+
]}
104+
/>`)
105+
})
38106
})
39107

40108
/**

0 commit comments

Comments
 (0)