Skip to content

Commit

Permalink
test: add test for #230
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh95 committed Aug 22, 2022
1 parent 0b7d4fd commit fe97580
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/__tests__/230/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@tailwind base;

@layer base {
#id {
@apply flex min-h-screen flex-col;
}
}
10 changes: 10 additions & 0 deletions src/__tests__/230/components.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@tailwind components;

@layer components {
.card {
background-color: theme('colors.white');
border-radius: theme('borderRadius.lg');
padding: theme('spacing.6');
box-shadow: theme('boxShadow.xl');
}
}
3 changes: 3 additions & 0 deletions src/__tests__/230/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import 'base.css';
@import 'components.css';
@import 'utils.css';
12 changes: 12 additions & 0 deletions src/__tests__/230/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<p class="card lg:dark:content-auto"></p>
</body>
</html>
15 changes: 15 additions & 0 deletions src/__tests__/230/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// https://github.com/nvh95/jest-preview/issues/230
import cssTransform from '../../preconfigTransform/css';
import fs from 'fs';
import path from 'path';

const filename = path.join(__dirname, 'index.css');
const cssSrc = fs.readFileSync(filename, 'utf8');

describe(`Tailwind CSS doesn't get compiled in @import'ed files`, () => {
it('should inline @import', () => {
expect(cssTransform.process(cssSrc, filename).code).toContain(
'https://tailwindcss.com',
);
});
});
24 changes: 24 additions & 0 deletions src/__tests__/230/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
'postcss-trolling': {
comicSans: true,
aling: false,
blur: false,
blurBlink: false,
clearfix: false,
heigth: false,
hideCursor: false,
hideOdd: false,
ms: false,
ren: false,
rotate: false,
roulette: false,
slowlyGrowText: false,
verImportant: false,
wait: false,
zIndex: false,
},
},
};
7 changes: 7 additions & 0 deletions src/__tests__/230/tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
content: ['./index.html'],
theme: {
extend: {},
},
plugins: [],
};
7 changes: 7 additions & 0 deletions src/__tests__/230/utils.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@tailwind utilities;

@layer utilities {
.content-auto {
content-visibility: auto;
}
}

0 comments on commit fe97580

Please sign in to comment.