@@ -6,6 +6,13 @@ import {
66 DATASET_KEYS ,
77 buildImagePmSelector ,
88 buildInlineImagePmSelector ,
9+ buildSdtBlockSelector ,
10+ buildSdtInlineSelector ,
11+ buildAnnotationSelector ,
12+ buildAnnotationTypeSelector ,
13+ buildAnnotationPmSelector ,
14+ SDT_BLOCK_WITH_ID_SELECTOR ,
15+ DRAGGABLE_SELECTOR ,
916} from './index.js' ;
1017
1118describe ( '@superdoc/dom-contract' , ( ) => {
@@ -18,10 +25,13 @@ describe('@superdoc/dom-contract', () => {
1825 BLOCK_SDT : 'superdoc-structured-content-block' ,
1926 TABLE_FRAGMENT : 'superdoc-table-fragment' ,
2027 DOCUMENT_SECTION : 'superdoc-document-section' ,
21- SDT_HOVER : 'sdt-hover' ,
28+ SDT_GROUP_HOVER : 'sdt-group -hover' ,
2229 IMAGE_FRAGMENT : 'superdoc-image-fragment' ,
2330 INLINE_IMAGE : 'superdoc-inline-image' ,
2431 INLINE_IMAGE_CLIP_WRAPPER : 'superdoc-inline-image-clip-wrapper' ,
32+ ANNOTATION : 'annotation' ,
33+ ANNOTATION_CONTENT : 'annotation-content' ,
34+ ANNOTATION_CARET_ANCHOR : 'annotation-caret-anchor' ,
2535 } ) ;
2636 } ) ;
2737
@@ -31,13 +41,29 @@ describe('@superdoc/dom-contract', () => {
3141 PM_END : 'data-pm-end' ,
3242 LAYOUT_EPOCH : 'data-layout-epoch' ,
3343 TABLE_BOUNDARIES : 'data-table-boundaries' ,
44+ SDT_ID : 'data-sdt-id' ,
45+ SDT_TYPE : 'data-sdt-type' ,
46+ FIELD_ID : 'data-field-id' ,
47+ FIELD_TYPE : 'data-field-type' ,
48+ DRAGGABLE : 'data-draggable' ,
49+ DISPLAY_LABEL : 'data-display-label' ,
50+ VARIANT : 'data-variant' ,
51+ TYPE : 'data-type' ,
3452 } ) ;
3553
3654 expect ( DATASET_KEYS ) . toEqual ( {
3755 PM_START : 'pmStart' ,
3856 PM_END : 'pmEnd' ,
3957 LAYOUT_EPOCH : 'layoutEpoch' ,
4058 TABLE_BOUNDARIES : 'tableBoundaries' ,
59+ SDT_ID : 'sdtId' ,
60+ SDT_TYPE : 'sdtType' ,
61+ FIELD_ID : 'fieldId' ,
62+ FIELD_TYPE : 'fieldType' ,
63+ DRAGGABLE : 'draggable' ,
64+ DISPLAY_LABEL : 'displayLabel' ,
65+ VARIANT : 'variant' ,
66+ TYPE : 'type' ,
4167 } ) ;
4268 } ) ;
4369
@@ -52,4 +78,32 @@ describe('@superdoc/dom-contract', () => {
5278 '.superdoc-inline-image-clip-wrapper[data-pm-start="99"], .superdoc-inline-image[data-pm-start="99"]' ,
5379 ) ;
5480 } ) ;
81+
82+ it ( 'builds a block SDT selector by escaped id' , ( ) => {
83+ expect ( buildSdtBlockSelector ( 'abc' ) ) . toBe ( '.superdoc-structured-content-block[data-sdt-id="abc"]' ) ;
84+ } ) ;
85+
86+ it ( 'builds an inline SDT selector by escaped id' , ( ) => {
87+ expect ( buildSdtInlineSelector ( 'abc' ) ) . toBe ( '.superdoc-structured-content-inline[data-sdt-id="abc"]' ) ;
88+ } ) ;
89+
90+ it ( 'builds the annotation selector with pm-start' , ( ) => {
91+ expect ( buildAnnotationSelector ( ) ) . toBe ( '.annotation[data-pm-start]' ) ;
92+ } ) ;
93+
94+ it ( 'builds an annotation type selector' , ( ) => {
95+ expect ( buildAnnotationTypeSelector ( 'html' ) ) . toBe ( '.annotation[data-type="html"]' ) ;
96+ } ) ;
97+
98+ it ( 'builds an annotation pm selector' , ( ) => {
99+ expect ( buildAnnotationPmSelector ( 42 ) ) . toBe ( '.annotation[data-pm-start="42"]' ) ;
100+ } ) ;
101+
102+ it ( 'exports SDT_BLOCK_WITH_ID_SELECTOR constant' , ( ) => {
103+ expect ( SDT_BLOCK_WITH_ID_SELECTOR ) . toBe ( '.superdoc-structured-content-block[data-sdt-id]' ) ;
104+ } ) ;
105+
106+ it ( 'exports DRAGGABLE_SELECTOR constant' , ( ) => {
107+ expect ( DRAGGABLE_SELECTOR ) . toBe ( '[data-draggable="true"]' ) ;
108+ } ) ;
55109} ) ;
0 commit comments