@@ -788,6 +788,89 @@ def test_structured_document_tag_checkbox_with_checked_1_is_checked(self):
788788
789789 assert_that (result , is_checkbox (checked = True ))
790790
791+ def test_when_structured_document_tag_checkbox_has_sdt_content_then_checkbox_replaces_single_character (self ):
792+ element = xml_element ("w:tbl" , {}, [
793+ w_tr (
794+ xml_element ("w:sdt" , {}, [
795+ xml_element ("w:sdtPr" , {}, [
796+ xml_element ("wordml:checkbox" , {}, [
797+ xml_element ("wordml:checked" , {"wordml:val" : "1" }),
798+ ]),
799+ ]),
800+ xml_element ("w:sdtContent" , {}, [
801+ xml_element ("w:tc" , {}, [
802+ xml_element ("w:p" , {}, [
803+ xml_element ("w:r" , {}, [
804+ xml_element ("w:t" , {}, [
805+ xml_text ("☐" ),
806+ ]),
807+ ]),
808+ ]),
809+ ]),
810+ ]),
811+ ]),
812+ ),
813+ ])
814+
815+ result = _read_and_get_document_xml_element (element )
816+
817+ assert_equal (result , documents .table ([
818+ documents .table_row ([
819+ documents .table_cell ([
820+ documents .paragraph ([
821+ documents .run ([
822+ documents .checkbox (checked = True ),
823+ ]),
824+ ]),
825+ ]),
826+ ]),
827+ ]))
828+
829+ def test_when_structured_document_tag_checkbox_has_sdt_content_then_deleted_content_is_ignored (self ):
830+ element = xml_element ("w:tbl" , {}, [
831+ w_tr (
832+ xml_element ("w:sdt" , {}, [
833+ xml_element ("w:sdtPr" , {}, [
834+ xml_element ("wordml:checkbox" , {}, [
835+ xml_element ("wordml:checked" , {"wordml:val" : "1" }),
836+ ]),
837+ ]),
838+ xml_element ("w:sdtContent" , {}, [
839+ xml_element ("w:tc" , {}, [
840+ xml_element ("w:p" , {}, [
841+ xml_element ("w:r" , {}, [
842+ xml_element ("w:t" , {}, [
843+ xml_text ("☐" ),
844+ ]),
845+ ]),
846+ xml_element ("w:del" , {}, [
847+ xml_element ("w:r" , {}, [
848+ xml_element ("w:t" , {}, [
849+ xml_text ("☐" )
850+ ])
851+ ])
852+ ]),
853+ ]),
854+ ]),
855+ ]),
856+ ]),
857+ ),
858+ ])
859+
860+ result = _read_and_get_document_xml_element (element )
861+
862+ assert_equal (result , documents .table ([
863+ documents .table_row ([
864+ documents .table_cell ([
865+ documents .paragraph ([
866+ documents .run ([
867+ documents .checkbox (checked = True ),
868+ ]),
869+ ]),
870+ ]),
871+ ]),
872+ ]))
873+
791874 def _complex_field_checkbox_paragraph (self , ff_data_children ):
792875 return xml_element ("w:p" , {}, [
793876 xml_element ("w:r" , {}, [
0 commit comments