-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: both wrapped and unwrapped dynamic() (#69780)
We should be testing both usage patterns, i.e. returning a component wrapped in a `{ default: ... }` and just a bare component. Note that the behavior here will partially change in 15, so this test is just so that we can avoid regressing in 14.x.
- Loading branch information
1 parent
a882e6e
commit 86547db
Showing
4 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
test/e2e/app-dir/dynamic/app/dynamic/named-export-unwrapped/client.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,5 @@ | ||
'use client' | ||
|
||
export function Button(props) { | ||
return <button {...props} /> | ||
} |
11 changes: 11 additions & 0 deletions
11
test/e2e/app-dir/dynamic/app/dynamic/named-export-unwrapped/page.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,11 @@ | ||
import dynamic from 'next/dynamic' | ||
|
||
const Button = dynamic(() => | ||
import('./client').then((mod) => { | ||
return mod.Button | ||
}) | ||
) | ||
|
||
export default function Page() { | ||
return <Button id="client-button">this is a client button</Button> | ||
} |
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
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