Skip to content

Commit

Permalink
feat(nvue-styler): css 展开 border-radius #14277
Browse files Browse the repository at this point in the history
  • Loading branch information
Otto-J committed Jan 16, 2025
1 parent 8d6cc0b commit 9d94911
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
32 changes: 22 additions & 10 deletions packages/uni-nvue-styler/__tests__/expand.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,22 @@ describe('nvue-styler: expand', () => {
'1px': [
{
type: 'decl',
prop: 'border-radius',
prop: 'border-top-left-radius',
value: '1px',
},
{
type: 'decl',
prop: 'border-top-right-radius',
value: '1px',
},
{
type: 'decl',
prop: 'border-bottom-right-radius',
value: '1px',
},
{
type: 'decl',
prop: 'border-bottom-left-radius',
value: '1px',
},
],
Expand Down Expand Up @@ -816,15 +831,12 @@ describe('nvue-styler: expand', () => {
const decl = parseDecl(`.test {
border-radius: ${value}
}`)
if (!value.includes(' ')) {
expect(transformBorderRadius(decl)).toEqual([decl])
} else {
expect(transformBorderRadius(decl)).toEqual(
borderRadius[value].map((node) => {
return Object.assign({ raws: decl.raws, source: decl.source }, node)
})
)
}

expect(transformBorderRadius(decl)).toEqual(
borderRadius[value].map((node) => {
return Object.assign({ raws: decl.raws, source: decl.source }, node)
})
)
})
})
test('transform flex-flow', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/uni-nvue-styler/src/expand/borderRadius.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export const transformBorderRadius: TransformDecl = (decl) => {
}
switch (splitResult.length) {
case 1:
return [decl]
splitResult.push(splitResult[0], splitResult[0], splitResult[0])
break
case 2:
splitResult.push(splitResult[0], splitResult[1])
break
Expand Down

0 comments on commit 9d94911

Please sign in to comment.