Skip to content

Commit

Permalink
fix(transformMultipleAttr): transformMultipleAttrs
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-He95 committed Jan 19, 2024
1 parent 9a74190 commit e613e67
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
- text10rpx -> text-\[length:10rpx\]
- hover:(text-red bg-blue) -> hover:text-red hover:bg-blue
- >500px:w10px -> max-[500px]:w-[10px]
- <500px:w10px -> min-[500px]:w-[10px]
- <500px:(w10px h20px) -> min-[500px]:w-[10px] min-[500px]:h-[20px]


## Configuration
Expand Down
18 changes: 17 additions & 1 deletion test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,28 @@ describe('should', () => {
transform('class="w10px >500px:w-10px w-20px"')).toMatchInlineSnapshot('"class=\\"w-[10px] max-[500px]:w-[10px] w-[20px]\\""')
expect(
transform('class=" >500px:w-10px w-20px"')).toMatchInlineSnapshot('"class=\\" max-[500px]:w-[10px] w-[20px]\\""')

expect(
transform('class="w10px <500px:w10px w-20px"')).toMatchInlineSnapshot('"class=\\"w-[10px] min-[500px]:w-[10px] w-[20px]\\""')
expect(
transform('class="w10px md:w10px w-20px"')).toMatchInlineSnapshot('"class=\\"w-[10px] md:w-[10px] w-[20px]\\""')
})

it('multiple attrs', () => {
expect(
transform('class="md:(w10px h20px)"')).toMatchInlineSnapshot('"class=\\"md:w-[10px] md:h-[20px]\\""')
expect(
transform('class="hover:(text-red bg-blue)"')).toMatchInlineSnapshot('"class=\\"hover:text-red hover:bg-blue\\""')
expect(
transformClass('hover:(text-red bg-blue)"')).toMatchInlineSnapshot('"hover:text-red hover:bg-blue\\""')
expect(
transformClass('hover:(flex-center)')).toMatchInlineSnapshot('"hover:flex hover:justify-center hover:items-center"')
expect(
transformClass('md:(flex-center)')).toMatchInlineSnapshot('"md:flex md:justify-center md:items-center"')
expect(
transformClass('<500px:(flex-center)')).toMatchInlineSnapshot('"min-[500px]:flex min-[500px]:justify-center min-[500px]:items-center"')
expect(
transformClass('<500px:(border#eee)')).toMatchInlineSnapshot('"min-[500px]:border-[#eee] min-[500px]:border min-[500px]:border-solid"')
})
})

describe('transformClass', () => {
Expand Down

0 comments on commit e613e67

Please sign in to comment.