Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(turbopack): migrate tailwind test cases from next-dev
- Loading branch information
Showing
5 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
15 changes: 14 additions & 1 deletion
15
test/integration/css-fixtures/with-tailwindcss/pages/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
export default function Home() { | ||
return <div /> | ||
return ( | ||
<div> | ||
<footer className="flex h-24 w-full items-center justify-center border-t"> | ||
<a | ||
className="flex items-center justify-center gap-2" | ||
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Powered by{' '} | ||
</a> | ||
</footer> | ||
</div> | ||
) | ||
} |
6 changes: 6 additions & 0 deletions
6
test/integration/css-fixtures/with-tailwindcss/postcss.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} |
12 changes: 12 additions & 0 deletions
12
test/integration/css-fixtures/with-tailwindcss/tailwind.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: [ | ||
'./pages/**/*.{js,ts,jsx,tsx}', | ||
'./components/**/*.{js,ts,jsx,tsx}', | ||
'./app/**/*.{js,ts,jsx,tsx}', | ||
], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* eslint-env jest */ | ||
import { createNext, FileRef } from 'e2e-utils' | ||
import webdriver from 'next-webdriver' | ||
import { join } from 'path' | ||
|
||
const fixturesDir = join(__dirname, '../..', 'css-fixtures') | ||
|
||
//[NOTE]: This test is migrated from next-dev integration tests for turbopack, | ||
//Extracted into a single test file so we can put this in blocking tests for turbopack (turbopack-tests-manifests.js) | ||
describe('Render css with tailwind', () => { | ||
const appDir = join(fixturesDir, 'with-tailwindcss') | ||
|
||
let next | ||
beforeAll(async () => { | ||
next = await createNext({ | ||
files: { | ||
pages: new FileRef(join(appDir, 'pages')), | ||
styles: new FileRef(join(appDir, 'styles')), | ||
'postcss.config.js': new FileRef(join(appDir, 'postcss.config.js')), | ||
'tailwind.config.js': new FileRef(join(appDir, 'tailwind.config.js')), | ||
}, | ||
dependencies: { | ||
postcss: '^8.4.29', | ||
tailwindcss: '^3.3.3', | ||
autoprefixer: '^10.4.13', | ||
}, | ||
}) | ||
}) | ||
|
||
afterAll(() => next?.destroy()) | ||
|
||
it('should apply global styles', async () => { | ||
let browser | ||
try { | ||
browser = await webdriver(next.url, '/') | ||
|
||
const alignItems = await browser.eval( | ||
`window.getComputedStyle(document.querySelector('footer')).alignItems` | ||
) | ||
expect(alignItems).toMatchInlineSnapshot(`"center"`) | ||
} finally { | ||
if (browser) { | ||
await browser.close() | ||
} | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters