Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve RegEx parser, reduce possibilities as the key for arbitrary properties #12121

Merged
merged 5 commits into from
Oct 2, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add real world tests for parsing candidate strings
  • Loading branch information
RobinMalfait committed Oct 2, 2023
commit 7aa35a6f97ac10dea7c2ff2a21ff6bd5da6c0ede
21 changes: 21 additions & 0 deletions tests/parse-candidate-strings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,4 +438,25 @@ describe.each([
expect(extractions).not.toContain(`bold`)
})
})

describe('real world', () => {
it.each([
[
'const myCVAComponent = cva([],{defaultVariants:{size:"md"},variants:{size:{sm:["p-1"],md:["p-1.5"],lg:["p-2"],xl:["p-2.5"]}}});',
],
[
'const myCVAComponent = cva([],{defaultVariants:{size:"md"}, variants:{size:{sm:["p-1"],md:["p-1.5"],lg:["p-2"],xl:["p-2.5"]}}});',
],
[
'const myCVAComponent = cva("",{defaultVariants:{size:"md"},variants:{size:{sm:["p-1"],md:["p-1.5"],lg:["p-2"],xl:["p-2.5"]}}});',
],
])('should work for issue #12109 (%#)', async (content) => {
let extractions = parse(content)

expect(extractions).toContain('p-1')
expect(extractions).toContain('p-1.5')
expect(extractions).toContain('p-2')
expect(extractions).toContain('p-2.5')
})
})
})