@@ -16,7 +16,7 @@ import ContentNode from 'docc-render/components/ContentNode.vue';
16
16
import DictionaryExample from 'docc-render/components/ContentNode/DictionaryExample.vue' ;
17
17
import EndpointExample from 'docc-render/components/ContentNode/EndpointExample.vue' ;
18
18
import Figure from 'docc-render/components/ContentNode/Figure.vue' ;
19
- import FigureCaption from 'docc-render/components/ContentNode/FigureCaption .vue' ;
19
+ import Caption from 'docc-render/components/ContentNode/Caption .vue' ;
20
20
import InlineImage from 'docc-render/components/ContentNode/InlineImage.vue' ;
21
21
import Reference from 'docc-render/components/ContentNode/Reference.vue' ;
22
22
import Table from 'docc-render/components/ContentNode/Table.vue' ;
@@ -112,29 +112,6 @@ 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`/`Figcaption` 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 ( FigureCaption ) ;
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
- } ) ;
138
115
} ) ;
139
116
140
117
describe ( 'with type="endpointExample"' , ( ) => {
@@ -714,7 +691,7 @@ describe('ContentNode', () => {
714
691
} , { } ) ) . not . toThrow ( ) ;
715
692
} ) ;
716
693
717
- it ( 'renders a `Figure`/`FigureCaption ` with metadata' , ( ) => {
694
+ it ( 'renders a `Figure`/`Caption ` with metadata' , ( ) => {
718
695
const metadata = {
719
696
anchor : '42' ,
720
697
title : 'Figure 42' ,
@@ -734,14 +711,14 @@ describe('ContentNode', () => {
734
711
expect ( figure . props ( 'anchor' ) ) . toBe ( metadata . anchor ) ;
735
712
expect ( figure . contains ( InlineImage ) ) . toBe ( true ) ;
736
713
737
- const caption = wrapper . find ( FigureCaption ) ;
714
+ const caption = wrapper . find ( Caption ) ;
738
715
expect ( caption . exists ( ) ) . toBe ( true ) ;
739
716
expect ( caption . contains ( 'p' ) ) . toBe ( true ) ;
740
717
expect ( caption . props ( 'title' ) ) . toBe ( metadata . title ) ;
741
718
expect ( caption . text ( ) ) . toContain ( 'blah' ) ;
742
719
} ) ;
743
720
744
- it ( 'renders a `Figure`/`FigureCaption ` without an anchor, with text under the image' , ( ) => {
721
+ it ( 'renders a `Figure`/`Caption ` without an anchor, with text under the image' , ( ) => {
745
722
const metadata = {
746
723
abstract : [ {
747
724
type : 'paragraph' ,
@@ -759,7 +736,7 @@ describe('ContentNode', () => {
759
736
expect ( figure . props ( 'anchor' ) ) . toBeFalsy ( ) ;
760
737
expect ( figure . contains ( InlineImage ) ) . toBe ( true ) ;
761
738
762
- const caption = wrapper . find ( FigureCaption ) ;
739
+ const caption = wrapper . find ( Caption ) ;
763
740
expect ( caption . exists ( ) ) . toBe ( true ) ;
764
741
expect ( caption . contains ( 'p' ) ) . toBe ( true ) ;
765
742
expect ( caption . props ( 'title' ) ) . toBeFalsy ( ) ;
@@ -769,9 +746,9 @@ describe('ContentNode', () => {
769
746
expect ( figure . html ( ) ) . toMatchInlineSnapshot ( `
770
747
<figure-stub>
771
748
<inlineimage-stub alt="" variants="[object Object],[object Object]"></inlineimage-stub>
772
- <figurecaption -stub centered="true">
749
+ <caption -stub centered="true" tag="figcaption ">
773
750
<p>blah</p>
774
- </figurecaption -stub>
751
+ </caption -stub>
775
752
</figure-stub>
776
753
` ) ;
777
754
} ) ;
@@ -791,9 +768,9 @@ describe('ContentNode', () => {
791
768
} , references ) ;
792
769
expect ( wrapper . find ( Figure ) . html ( ) ) . toMatchInlineSnapshot ( `
793
770
<figure-stub>
794
- <figurecaption -stub title="foo">
771
+ <caption -stub title="foo" tag="figcaption ">
795
772
<p>blah</p>
796
- </figurecaption -stub>
773
+ </caption -stub>
797
774
<inlineimage-stub alt="" variants="[object Object],[object Object]"></inlineimage-stub>
798
775
</figure-stub>
799
776
` ) ;
@@ -816,7 +793,7 @@ describe('ContentNode', () => {
816
793
expect ( figure . props ( 'anchor' ) ) . toBe ( 'foo-figure' ) ;
817
794
expect ( figure . contains ( InlineImage ) ) . toBe ( true ) ;
818
795
819
- expect ( wrapper . find ( FigureCaption ) . exists ( ) ) . toBe ( false ) ;
796
+ expect ( wrapper . find ( Caption ) . exists ( ) ) . toBe ( false ) ;
820
797
} ) ;
821
798
822
799
it ( 'renders within a `DeviceFrame`' , ( ) => {
@@ -892,7 +869,7 @@ describe('ContentNode', () => {
892
869
} , { } ) ) . not . toThrow ( ) ;
893
870
} ) ;
894
871
895
- it ( 'renders a `Figure`/`FigureCaption ` with metadata' , ( ) => {
872
+ it ( 'renders a `Figure`/`Caption ` with metadata' , ( ) => {
896
873
const metadata = {
897
874
anchor : 'foo' ,
898
875
abstract : [ {
@@ -911,15 +888,16 @@ describe('ContentNode', () => {
911
888
expect ( figure . props ( 'anchor' ) ) . toBe ( 'foo' ) ;
912
889
expect ( figure . contains ( BlockVideo ) ) . toBe ( true ) ;
913
890
914
- const caption = wrapper . find ( FigureCaption ) ;
891
+ const caption = wrapper . find ( Caption ) ;
915
892
expect ( caption . exists ( ) ) . toBe ( true ) ;
893
+ expect ( caption . props ( 'tag' ) ) . toBe ( 'figcaption' ) ;
916
894
expect ( caption . contains ( 'p' ) ) . toBe ( true ) ;
917
895
expect ( caption . props ( 'title' ) ) . toBe ( metadata . title ) ;
918
896
expect ( caption . props ( 'centered' ) ) . toBe ( true ) ;
919
897
expect ( caption . text ( ) ) . toContain ( 'blah' ) ;
920
898
} ) ;
921
899
922
- it ( 'renders a `Figure`/`FigureCaption ` without an anchor, with text under the video' , ( ) => {
900
+ it ( 'renders a `Figure`/`Caption ` without an anchor, with text under the video' , ( ) => {
923
901
const metadata = {
924
902
abstract : [ {
925
903
type : 'paragraph' ,
@@ -937,7 +915,7 @@ describe('ContentNode', () => {
937
915
expect ( figure . props ( 'anchor' ) ) . toBeFalsy ( ) ;
938
916
expect ( figure . contains ( BlockVideo ) ) . toBe ( true ) ;
939
917
940
- const caption = wrapper . find ( FigureCaption ) ;
918
+ const caption = wrapper . find ( Caption ) ;
941
919
expect ( caption . exists ( ) ) . toBe ( true ) ;
942
920
expect ( caption . contains ( 'p' ) ) . toBe ( true ) ;
943
921
expect ( caption . props ( 'title' ) ) . toBeFalsy ( ) ;
@@ -947,9 +925,9 @@ describe('ContentNode', () => {
947
925
expect ( figure . html ( ) ) . toMatchInlineSnapshot ( `
948
926
<figure-stub>
949
927
<blockvideo-stub identifier="video.mp4"></blockvideo-stub>
950
- <figurecaption -stub centered="true">
928
+ <caption -stub centered="true" tag="figcaption ">
951
929
<p>blah</p>
952
- </figurecaption -stub>
930
+ </caption -stub>
953
931
</figure-stub>
954
932
` ) ;
955
933
} ) ;
@@ -1372,6 +1350,33 @@ describe('ContentNode', () => {
1372
1350
expect ( table . findAll ( 'tbody tr td' ) . length ) . toBe ( 4 ) ;
1373
1351
} ) ;
1374
1352
1353
+ it ( 'renders a `Table` with metadata' , ( ) => {
1354
+ const metadata = {
1355
+ anchor : '42' ,
1356
+ title : 'Listing 42' ,
1357
+ abstract : [ {
1358
+ type : 'paragraph' ,
1359
+ inlineContent : [ { type : 'text' , text : 'blah' } ] ,
1360
+ } ] ,
1361
+ } ;
1362
+
1363
+ const wrapper = mountWithItem ( {
1364
+ type : 'table' ,
1365
+ header : TableHeaderStyle . none ,
1366
+ rows,
1367
+ metadata,
1368
+ } ) ;
1369
+
1370
+ const table = wrapper . find ( '.content' ) . find ( Table ) ;
1371
+ expect ( table . exists ( ) ) . toBe ( true ) ;
1372
+ expect ( table . attributes ( 'id' ) ) . toBe ( metadata . anchor ) ;
1373
+
1374
+ const caption = wrapper . find ( Caption ) ;
1375
+ expect ( caption . exists ( ) ) . toBe ( true ) ;
1376
+ expect ( caption . props ( 'title' ) ) . toBe ( metadata . title ) ;
1377
+ expect ( caption . text ( ) ) . toContain ( 'blah' ) ;
1378
+ } ) ;
1379
+
1375
1380
it ( 'renders header="both" style tables' , ( ) => {
1376
1381
const wrapper = mountWithItem ( {
1377
1382
type : 'table' ,
@@ -1410,35 +1415,6 @@ describe('ContentNode', () => {
1410
1415
expect ( table . findAll ( 'tbody tr td' ) . length ) . toBe ( 2 ) ;
1411
1416
} ) ;
1412
1417
1413
- it ( 'renders a `Figure`/`FigureCaption` with metadata' , ( ) => {
1414
- const metadata = {
1415
- anchor : '42' ,
1416
- title : 'Table 42' ,
1417
- abstract : [ {
1418
- type : 'paragraph' ,
1419
- inlineContent : [ { type : 'text' , text : 'blah' } ] ,
1420
- } ] ,
1421
- } ;
1422
- const wrapper = mountWithItem ( {
1423
- type : 'table' ,
1424
- header : TableHeaderStyle . none ,
1425
- rows,
1426
- metadata,
1427
- } ) ;
1428
-
1429
- const figure = wrapper . find ( Figure ) ;
1430
- expect ( figure . exists ( ) ) . toBe ( true ) ;
1431
- expect ( figure . props ( 'anchor' ) ) . toBe ( metadata . anchor ) ;
1432
- expect ( figure . contains ( Table ) ) . toBe ( true ) ;
1433
-
1434
- const caption = figure . find ( FigureCaption ) ;
1435
- expect ( caption . exists ( ) ) . toBe ( true ) ;
1436
- expect ( caption . props ( 'title' ) ) . toBe ( metadata . title ) ;
1437
- expect ( caption . props ( 'centered' ) ) . toBe ( false ) ;
1438
- expect ( caption . contains ( 'p' ) ) . toBe ( true ) ;
1439
- expect ( caption . text ( ) ) . toContain ( 'blah' ) ;
1440
- } ) ;
1441
-
1442
1418
describe ( 'and column/row spanning' , ( ) => {
1443
1419
// <table>
1444
1420
// <tr>
0 commit comments