@@ -12,7 +12,6 @@ import { shallowMount } from '@vue/test-utils';
12
12
import Card from 'docc-render/components/Card.vue' ;
13
13
import CardSize from 'docc-render/constants/CardSize' ;
14
14
import Reference from 'docc-render/components/ContentNode/Reference.vue' ;
15
- import ContentNode from 'docc-render/components/ContentNode.vue' ;
16
15
import { flushPromises } from '../../../test-utils' ;
17
16
18
17
const {
@@ -44,9 +43,6 @@ describe('Card', () => {
44
43
const mountCard = options => shallowMount ( Card , {
45
44
propsData,
46
45
provide,
47
- stubs : {
48
- ContentNode,
49
- } ,
50
46
...options ,
51
47
} ) ;
52
48
@@ -188,20 +184,24 @@ describe('Card', () => {
188
184
expect ( h3 . text ( ) ) . toBe ( propsData . title ) ;
189
185
} ) ;
190
186
191
- it ( 'renders a `ContentNode` when content is provided ' , async ( ) => {
192
- const content = [
193
- {
194
- type : 'paragraph' ,
195
- inlineContent : [ { type : 'text' , text : 'hello world' } ] ,
187
+ it ( 'renders content in the default slot ' , async ( ) => {
188
+ const content = 'Foo bar baz' ;
189
+ const wrapper = mountCard ( {
190
+ slots : {
191
+ default : content ,
196
192
} ,
197
- ] ;
198
- const propsWithContent = { ...propsData , content } ;
199
- const wrapper = mountCard ( { propsData : propsWithContent } ) ;
193
+ } ) ;
194
+ await flushPromises ( ) ;
195
+ const contentDiv = wrapper . find ( '.card-content' ) ;
196
+ expect ( contentDiv . exists ( ) ) . toBe ( true ) ;
197
+ expect ( contentDiv . text ( ) ) . toEqual ( content ) ;
198
+ expect ( contentDiv . attributes ( 'id' ) ) . toMatch ( cardContentIdRE ) ;
199
+ } ) ;
200
+
201
+ it ( 'does not render the card-content, if no default slot provided' , async ( ) => {
202
+ const wrapper = mountCard ( ) ;
200
203
await flushPromises ( ) ;
201
- const node = wrapper . find ( ContentNode ) ;
202
- expect ( node . exists ( ) ) . toBe ( true ) ;
203
- expect ( node . props ( 'content' ) ) . toEqual ( content ) ;
204
- expect ( node . attributes ( 'id' ) ) . toMatch ( cardContentIdRE ) ;
204
+ expect ( wrapper . find ( '.card-content' ) . exists ( ) ) . toBe ( false ) ;
205
205
} ) ;
206
206
207
207
it ( 'renders card as a `floatingStyle`' , ( ) => {
0 commit comments