@@ -112,6 +112,29 @@ describe('ContentNode', () => {
112
112
expect ( codeListing . props ( 'content' ) ) . toEqual ( listing . code ) ;
113
113
expect ( codeListing . isEmpty ( ) ) . toBe ( true ) ;
114
114
} ) ;
115
+
116
+ it ( 'renders a `Figure`/`Caption` with metadata' , ( ) => {
117
+ const metadata = {
118
+ anchor : '42' ,
119
+ title : 'Listing 42' ,
120
+ abstract : [ {
121
+ type : 'paragraph' ,
122
+ inlineContent : [ { type : 'text' , text : 'blah' } ] ,
123
+ } ] ,
124
+ } ;
125
+ const wrapper = mountWithItem ( { ...listing , metadata } ) ;
126
+
127
+ const figure = wrapper . find ( Figure ) ;
128
+ expect ( figure . exists ( ) ) . toBe ( true ) ;
129
+ expect ( figure . props ( 'anchor' ) ) . toBe ( metadata . anchor ) ;
130
+ expect ( figure . contains ( CodeListing ) ) . toBe ( true ) ;
131
+
132
+ const caption = figure . find ( Caption ) ;
133
+ expect ( caption . exists ( ) ) . toBe ( true ) ;
134
+ expect ( caption . props ( 'title' ) ) . toBe ( metadata . title ) ;
135
+ expect ( caption . contains ( 'p' ) ) . toBe ( true ) ;
136
+ expect ( caption . text ( ) ) . toContain ( 'blah' ) ;
137
+ } ) ;
115
138
} ) ;
116
139
117
140
describe ( 'with type="endpointExample"' , ( ) => {
@@ -753,7 +776,7 @@ describe('ContentNode', () => {
753
776
` ) ;
754
777
} ) ;
755
778
756
- it ( 'renders a `FigureCaption ` before the image, if it has a title' , ( ) => {
779
+ it ( 'renders a `Caption ` before the image, if it has a title' , ( ) => {
757
780
const metadata = {
758
781
title : 'foo' ,
759
782
abstract : [ {
@@ -776,7 +799,7 @@ describe('ContentNode', () => {
776
799
` ) ;
777
800
} ) ;
778
801
779
- it ( 'renders no `FigureCaption `, if there is a `title`, but no `abstract`' , ( ) => {
802
+ it ( 'renders no `Caption `, if there is a `title`, but no `abstract`' , ( ) => {
780
803
const metadata = {
781
804
postTitle : true ,
782
805
title : 'Foo' ,
0 commit comments