Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
chu121su12 committed Jul 2, 2022
1 parent 1caefac commit fb0f2f5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
1 change: 0 additions & 1 deletion packages/preset-mini/src/utils/utilities.ts
Expand Up @@ -205,7 +205,6 @@ export const makeGlobalStaticRules = (prefix: string, property?: string) => {
return globalKeywords.map(keyword => [`${prefix}-${keyword}`, { [property ?? prefix]: keyword }] as Rule)
}


export function getComponent(str: string, open: string, close: string, separator: string) {
if (str === '')
return
Expand Down
3 changes: 1 addition & 2 deletions packages/preset-mini/src/variants/misc.ts
@@ -1,6 +1,5 @@
import type { Variant } from '@unocss/core'
import { getComponent } from '../utils'
import { handler as h } from '../utils'
import { getComponent, handler as h } from '../utils'

export const variantSelector: Variant = {
name: 'selector',
Expand Down
17 changes: 8 additions & 9 deletions test/utils.test.ts
Expand Up @@ -26,17 +26,16 @@ it('mergeDeep', () => {
it('getComponents', () => {
const fn1 = (s: string) => getComponent(s, '(', ')', ',')

expect(fn1('comma,separated')).eql(['comma','separated'])
expect(fn1('comma ,separated')).eql(['comma ','separated'])
expect(fn1('comma, separated')).eql(['comma',' separated'])
expect(fn1('comma , separated ')).eql(['comma ',' separated '])
expect(fn1('comma,separated')).eql(['comma', 'separated'])
expect(fn1('comma ,separated')).eql(['comma ', 'separated'])
expect(fn1('comma, separated')).eql(['comma', ' separated'])
expect(fn1('comma , separated ')).eql(['comma ', ' separated '])

expect(fn1('first,')).eql(undefined)
expect(fn1(',last')).eql(undefined)

expect(fn1('comma,separated,')).eql(['comma','separated,'])
expect(fn1('comma,separated,once')).eql(['comma','separated,once'])
expect(fn1('comma(),separated(value)')).eql(['comma()','separated(value)'])
expect(fn1('not(comma,separated)')).eql(['not(comma,separated)',''])

expect(fn1('comma,separated,')).eql(['comma', 'separated,'])
expect(fn1('comma,separated,once')).eql(['comma', 'separated,once'])
expect(fn1('comma(),separated(value)')).eql(['comma()', 'separated(value)'])
expect(fn1('not(comma,separated)')).eql(['not(comma,separated)', ''])
})

0 comments on commit fb0f2f5

Please sign in to comment.