diff --git a/index.js b/index.js index e5be002..975fe67 100644 --- a/index.js +++ b/index.js @@ -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 diff --git a/test/selectors.test.js b/test/selectors.test.js index 52c6570..7cbb7f2 100644 --- a/test/selectors.test.js +++ b/test/selectors.test.js @@ -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) {}`],