mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
[editor-core] allow empty ranges on rawAddCommentOperation (#36073)
GitOrigin-RevId: 8674a2b458770439925047aab9a129242eb984d4
This commit is contained in:
@@ -47,7 +47,7 @@ const rawRange = z.strictObject({
|
||||
|
||||
const rawAddCommentOperation = z.strictObject({
|
||||
commentId: zz.objectId(),
|
||||
ranges: z.array(rawRange).min(1),
|
||||
ranges: z.array(rawRange),
|
||||
resolved: z.boolean().optional(),
|
||||
})
|
||||
|
||||
|
||||
@@ -17,6 +17,18 @@ describe('AddCommentOperation', function () {
|
||||
expect(op.resolved).to.be.true
|
||||
})
|
||||
|
||||
it('constructs a collapsed AddCommentOperation fromJSON', function () {
|
||||
const op = AddCommentOperation.fromJSON({
|
||||
commentId: '123',
|
||||
resolved: true,
|
||||
ranges: [],
|
||||
})
|
||||
expect(op).to.be.instanceOf(AddCommentOperation)
|
||||
expect(op.commentId).to.equal('123')
|
||||
expect(op.ranges).to.be.deep.equal([])
|
||||
expect(op.resolved).to.be.true
|
||||
})
|
||||
|
||||
it('should convert to JSON', function () {
|
||||
const op = new AddCommentOperation('123', [new Range(0, 1)])
|
||||
expect(op.toJSON()).to.eql({
|
||||
|
||||
Reference in New Issue
Block a user