Skip to content
Merged
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
18 changes: 14 additions & 4 deletions tests/purgeUnusedStyles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ function suppressConsoleLogs(cb, type = 'warn') {
}
}

function dropTailwindHeader(css) {
let [header, ...lines] = css.split('\n')

expect(
/\/*! tailwindcss v\d*\.\d*\.\d* \| MIT License \| https:\/\/tailwindcss.com \*\//g.test(header)
).toBe(true)

return lines.join('\n')
}

function extractRules(root) {
let rules = []

Expand Down Expand Up @@ -450,7 +460,7 @@ test(
'utf8'
)

expect(result.css).toMatchCss(expected)
expect(dropTailwindHeader(result.css)).toMatchCss(dropTailwindHeader(expected))
})
})
)
Expand All @@ -477,7 +487,7 @@ test('does not purge if the array is empty', () => {
'utf8'
)

expect(result.css).toMatchCss(expected)
expect(dropTailwindHeader(result.css)).toMatchCss(dropTailwindHeader(expected))
})
})
)
Expand All @@ -502,7 +512,7 @@ test('does not purge if explicitly disabled', () => {
'utf8'
)

expect(result.css).toMatchCss(expected)
expect(dropTailwindHeader(result.css)).toMatchCss(dropTailwindHeader(expected))
})
})
)
Expand All @@ -527,7 +537,7 @@ test('does not purge if purge is simply false', () => {
'utf8'
)

expect(result.css).toMatchCss(expected)
expect(dropTailwindHeader(result.css)).toMatchCss(dropTailwindHeader(expected))
})
})
)
Expand Down