Skip to content

Commit

Permalink
fix(core): group body match question mark (#2017)
Browse files Browse the repository at this point in the history
  • Loading branch information
action-hong committed Dec 22, 2022
1 parent eb128ae commit 0dca3e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/utils/variantGroup.ts
@@ -1,6 +1,6 @@
import type MagicString from 'magic-string'

export const regexClassGroup = /((?:[!@\w+:_/-]|\[&?>?:?.*\])+?)([:-])\(((?:[~!\w\s:/\\,%#.$-]|\[.*?\])+?)\)(?!\s*?=>)/gm
export const regexClassGroup = /((?:[!@\w+:_/-]|\[&?>?:?.*\])+?)([:-])\(((?:[~!\w\s:/\\,%#.$?-]|\[.*?\])+?)\)(?!\s*?=>)/gm

export function expandVariantGroup(str: string, separators?: string[], depth?: number): string
export function expandVariantGroup(str: MagicString, separators?: string[], depth?: number): MagicString
Expand Down
4 changes: 4 additions & 0 deletions test/variant-group.test.ts
Expand Up @@ -52,4 +52,8 @@ describe('variant-group', () => {
expect(expandVariantGroup('@a:(c-d d-c)')).toEqual('@a:c-d @a:d-c')
expect(expandVariantGroup('!@a:(c-d d-c)')).toEqual('!@a:c-d !@a:d-c')
})

test('inlucde ?', async () => {
expect(expandVariantGroup('a:(b?c d)')).toEqual('a:b?c a:d')
})
})

0 comments on commit 0dca3e5

Please sign in to comment.