@@ -124,8 +124,9 @@ describe('DocPermissionController', () => {
124124
125125 it ( 'uses section and paragraph ids as hierarchical edit boundaries' , async ( ) => {
126126 const firstSection = document . getSection ( 0 ) ! ;
127- const firstParagraph = document . getParagraph ( 'paragraph-one' ) ! ;
127+ const firstParagraph = document . getParagraphs ( ) [ 0 ] ;
128128 const secondParagraph = document . getParagraph ( 'paragraph-two' ) ! ;
129+ if ( ! firstParagraph ) throw new Error ( 'Paragraph not found.' ) ;
129130
130131 await firstSection . getPermission ( ) . setReadOnly ( ) ;
131132
@@ -206,9 +207,11 @@ describe('DocPermissionController', () => {
206207 univer = testBed . univer ;
207208 get = testBed . get ;
208209 document = testBed . univerAPI . getActiveDocument ( ) ! ;
209- await document . getEntityPermission ( '' , 'drawing' , 'drawing-one' ) . setEditable ( false ) ;
210+ const drawingId = document . getDocumentDataModel ( ) . getSnapshot ( ) . drawingsOrder ?. [ 0 ] ;
211+ if ( ! drawingId ) throw new Error ( 'Drawing not found.' ) ;
212+ await document . getEntityPermission ( '' , 'drawing' , drawingId ) . setReadOnly ( ) ;
210213 const actions = JSONX . getInstance ( ) . replaceOp (
211- [ 'drawings' , 'drawing-one' , 'docTransform' , 'angle' ] ,
214+ [ 'drawings' , drawingId , 'docTransform' , 'angle' ] ,
212215 0 ,
213216 15
214217 ) ;
@@ -219,7 +222,7 @@ describe('DocPermissionController', () => {
219222 actions,
220223 textRanges : [ ] ,
221224 } ) ) . toBe ( false ) ;
222- expect ( document . getDocumentDataModel ( ) . getSnapshot ( ) . drawings ?. [ 'drawing-one' ] . docTransform ?. angle ) . toBe ( 0 ) ;
225+ expect ( document . getDocumentDataModel ( ) . getSnapshot ( ) . drawings ?. [ drawingId ] . docTransform ?. angle ) . toBe ( 0 ) ;
223226 } ) ;
224227
225228 it ( 'enforces paragraph permission on direct RichText mutations used by paste and undo/redo' , async ( ) => {
0 commit comments