Skip to content

Commit

Permalink
fix: split classes on all whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Vehmloewff committed Aug 4, 2022
1 parent 54dae48 commit 9a2df97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions alias.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ Deno.test({
},
})

Deno.test({
name: '[alias] should substitute classes with newlines',
fn() {
const map = aliasMap([alias('alias-name', 'base-styles to-apply')])

const input = `
alias-name
alias-name-foo-bar alias-name-foo-bar-baz`
const output = 'base-styles to-apply base-styles to-apply base-styles to-apply'

assertEquals(lookup(map, input), output)
},
})

Deno.test({
name: '[alias] should apply variations',
fn() {
Expand Down
2 changes: 1 addition & 1 deletion alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function alias(name: string, params: AliasParams | string | AliasFn): Ali
}

function splitClasses(classes: string) {
return classes.split(/ +/)
return classes.trim().split(/\s+/)
}

function joinClassSections(sections: string[]) {
Expand Down

0 comments on commit 9a2df97

Please sign in to comment.