Skip to content

Commit

Permalink
add test that verifies @layer is removed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed Jul 1, 2021
1 parent 4ef5d81 commit 051d1a4
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions integrations/tailwindcss-cli/tests/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,61 @@ describe('watcher', () => {
return runningProcess.stop()
})

test('@layers are replace when the html file changes', async () => {
await writeInputFile('index.html', html`<div class="font-bold"></div>`)
await writeInputFile(
'index.css',
css`
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
html {
scroll-behavior: smooth;
}
}
`
)

let runningProcess = $('node ../../lib/cli.js -i ./src/index.css -o ./dist/main.css -w')

await waitForOutputFileCreation('main.css')

expect(await readOutputFile('main.css')).toIncludeCss(
css`
.font-bold {
font-weight: 700;
}
`
)

await waitForOutputFileChange('main.css', async () => {
await appendToInputFile('index.html', html`<div class="font-normal"></div>`)
})

expect(await readOutputFile('main.css')).not.toIncludeCss(css`
@layer base {
html {
scroll-behavior: smooth;
}
}
`)

expect(await readOutputFile('main.css')).toIncludeCss(
css`
.font-bold {
font-weight: 700;
}
.font-normal {
font-weight: 400;
}
`
)

return runningProcess.stop()
})

test('classes are generated when the tailwind.config.js file changes', async () => {
await writeInputFile('index.html', html`<div class="font-bold md:font-medium"></div>`)

Expand Down

0 comments on commit 051d1a4

Please sign in to comment.