@@ -12,7 +12,6 @@ import { shallowMount } from '@vue/test-utils';
1212import Card from 'docc-render/components/Card.vue' ;
1313import CardSize from 'docc-render/constants/CardSize' ;
1414import Reference from 'docc-render/components/ContentNode/Reference.vue' ;
15- import ContentNode from 'docc-render/components/ContentNode.vue' ;
1615import { flushPromises } from '../../../test-utils' ;
1716
1817const {
@@ -44,9 +43,6 @@ describe('Card', () => {
4443 const mountCard = options => shallowMount ( Card , {
4544 propsData,
4645 provide,
47- stubs : {
48- ContentNode,
49- } ,
5046 ...options ,
5147 } ) ;
5248
@@ -188,20 +184,24 @@ describe('Card', () => {
188184 expect ( h3 . text ( ) ) . toBe ( propsData . title ) ;
189185 } ) ;
190186
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 ,
196192 } ,
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 ( ) ;
200203 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 ) ;
205205 } ) ;
206206
207207 it ( 'renders card as a `floatingStyle`' , ( ) => {
0 commit comments