Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export function format(css, { minify = false } = {}) {

children.forEach((child) => {
switch (child.type) {
case 'TypeSelector': {
buffer += lowercase(child.name)
break
}
case 'Combinator': {
// putting spaces around `child.name` (+ > ~ or ' '), unless the combinator is ' '
buffer += SPACE
Expand Down
12 changes: 12 additions & 0 deletions test/selectors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ a > b ~ c d,
assert.equal(actual, expected)
})

test('lowercases type selectors', () => {
let actual = format(`
A,
B,
C {}
`)
let expected = `a,
b,
c {}`
assert.equal(actual, expected)
})

test('formats nested selector combinators', () => {
let fixtures = [
[`:where(a+b) {}`, `:where(a + b) {}`],
Expand Down
Loading