Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Sep 19, 2024
1 parent 48e3c14 commit 8c2f031
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/development/css-error/app/css-error/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

export default function Page() {
return (
<>
<div></div>
</>
)
}
19 changes: 19 additions & 0 deletions test/development/css-error/app/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Correct syntax: input::placeholder */
input:placeholder {
color: red;
}

.rowContainer {
&.header {
/* Correct syntax: &.darktheme */
&:darktheme {
border-bottom-color: var(--accents-2);
}
}

/* Correct syntax: &.global(.dark-theme) */
&:global(.dark-theme) & {
background: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.5) 100%);
}
}

7 changes: 7 additions & 0 deletions test/development/css-error/app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use client'

import './global.css'

export default function Layout({ children }) {
return <>{children}</>
}
32 changes: 32 additions & 0 deletions test/development/css-error/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { nextTestSetup } from 'e2e-utils'
import { getRedboxSource } from 'next-test-utils'

describe('app dir - css', () => {
const { next, skipped } = nextTestSetup({
files: __dirname,
skipDeployment: true,
dependencies: {
sass: 'latest',
},
})

if (skipped) {
return
}

describe('css support', () => {
// css-loader does not report an error for this case
;(process.env.TURBOPACK ? describe : describe.skip)(
'error handling',
() => {
it('should report human-readable error message for css', async () => {
const browser = await next.browser('/css-error')

const source = await getRedboxSource(browser)

expect(source).toMatchInlineSnapshot()
})
}
)
})
})

0 comments on commit 8c2f031

Please sign in to comment.