Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkirsz committed May 8, 2023
1 parent ee1a23f commit f45fe10
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import '../styles/globals.css'
import type { AppProps } from 'next/app'

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { useTestHarness } from '@turbo/pack-test-harness'

export default function Home() {
useTestHarness(runTests)

return (
<main>
<div>
<button>One</button>
<button className="localButton">Two</button>
</div>
</main>
)
}

function runTests() {
it('it should apply PostCSS styles to local and foreign code', () => {
const buttons = Array.from(document.querySelectorAll('button'))

expect(buttons.length).toBe(2)
expect(getComputedStyle(buttons[0]).height).toBe(50)
expect(getComputedStyle(buttons[1]).height).toBe(50)
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
plugins: [['postcss-preset-env']],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "mod/style.css";

.localButton {
height: mod(50px, 51px);
}
3 changes: 2 additions & 1 deletion packages/next-swc/crates/next-dev-tests/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"next": "*",
"postcss": "8.4.14",
"react-test-renderer": "18.2.0",
"tailwindcss": "1.1.3"
"tailwindcss": "1.1.3",
"postcss-preset-env": "8.3.2"
}
}

0 comments on commit f45fe10

Please sign in to comment.