@@ -57,7 +57,7 @@ describe('SettingsXml', () => {
5757 position : 'beneathText' ,
5858 } ) ;
5959 } ) ;
60- it ( 'documentProtection' , async ( ) => {
60+ it ( 'documentProtection with edit property ' , async ( ) => {
6161 const settings = new SettingsXml ( 'test' ) ;
6262 expect ( settings . get ( 'documentProtection' ) ) . toBe ( null ) ;
6363 settings . set ( 'documentProtection' , {
@@ -84,4 +84,28 @@ describe('SettingsXml', () => {
8484 docxFromArchive . document . settings . get ( 'documentProtection' )
8585 ) . toEqual ( customSettings ) ;
8686 } ) ;
87+ it ( 'documentProtection without edit' , async ( ) => {
88+ const settings = new SettingsXml ( 'test' ) ;
89+ expect ( settings . get ( 'documentProtection' ) ) . toBe ( null ) ;
90+ settings . set ( 'documentProtection' , {
91+ enforcement : true ,
92+ } ) ;
93+ expect ( settings . get ( 'documentProtection' ) ) . toEqual ( {
94+ enforcement : true ,
95+ } ) ;
96+
97+ expect ( serialize ( await settings . $$$toNode ( ) ) ) . toEqual (
98+ `<w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:documentProtection w:enforcement="true"/></w:settings>`
99+ ) ;
100+
101+ const docx = Docx . fromNothing ( ) ;
102+ const customSettings : DocumentProtectionProps = {
103+ enforcement : false ,
104+ } ;
105+ docx . document . settings . set ( 'documentProtection' , customSettings ) ;
106+ const docxFromArchive = await Docx . fromArchive ( await docx . toArchive ( ) ) ;
107+ expect (
108+ docxFromArchive . document . settings . get ( 'documentProtection' )
109+ ) . toEqual ( customSettings ) ;
110+ } ) ;
87111} ) ;
0 commit comments