@@ -6,6 +6,7 @@ import { flushPromises, mount } from '@vue/test-utils'
6
6
7
7
import { createClientOnly } from '../../packages/nuxt/src/app/components/client-only'
8
8
import { createClientPage } from '../../packages/nuxt/dist/components/runtime/client-component'
9
+ import { ClientOnly } from '#components'
9
10
10
11
describe ( 'client pages' , ( ) => {
11
12
it ( 'should render without a wrapper' , async ( ) => {
@@ -52,6 +53,32 @@ describe('client pages', () => {
52
53
} )
53
54
} )
54
55
56
+ describe ( 'client-only' , ( ) => {
57
+ it ( 'should render its children' , async ( ) => {
58
+ const component = defineComponent ( {
59
+ setup ( ) {
60
+ return ( ) => h ( ClientOnly , { } , {
61
+ default : ( ) => h ( 'div' , { } , 'client-only' ) ,
62
+ } )
63
+ } ,
64
+ } )
65
+ const wrapper = await mountSuspended ( component )
66
+ expect ( wrapper . html ( ) ) . toMatchInlineSnapshot ( `"<div>client-only</div>"` )
67
+ } )
68
+
69
+ it ( 'should support inherited attributes' , async ( ) => {
70
+ const component = defineComponent ( {
71
+ setup ( ) {
72
+ return ( ) => h ( ClientOnly , { class : 'test' , id : 'test' } , {
73
+ default : ( ) => h ( 'div' , { } , 'client-only' ) ,
74
+ } )
75
+ } ,
76
+ } )
77
+ const wrapper = await mountSuspended ( component )
78
+ expect ( wrapper . html ( ) ) . toMatchInlineSnapshot ( `"<div class="test" id="test">client-only</div>"` )
79
+ } )
80
+ } )
81
+
55
82
const Client = defineComponent ( {
56
83
name : 'TestClient' ,
57
84
setup ( ) {
0 commit comments