|
|
@@ -296,86 +296,4 @@ describe( 'ChangeOperation', () => {
|
|
|
expect( clone.newAttr.isEqual( newAttr ) ).to.be.true;
|
|
|
expect( clone.baseVersion ).to.equal( baseVersion );
|
|
|
} );
|
|
|
-
|
|
|
- describe( 'have conflicting attributes', () => {
|
|
|
- it( 'if it sets an attribute that is removed by the other operation', () => {
|
|
|
- let op = new ChangeOperation(
|
|
|
- new Range( new Position( [ 0 ], root ), new Position( [ 1 ], root ) ),
|
|
|
- new Attribute( 'foo', 'old' ),
|
|
|
- new Attribute( 'foo', 'bar' ),
|
|
|
- doc.version
|
|
|
- );
|
|
|
-
|
|
|
- let op2 = new ChangeOperation(
|
|
|
- new Range( new Position( [ 0 ], root ), new Position( [ 1 ], root ) ),
|
|
|
- new Attribute( 'foo', 'old' ),
|
|
|
- null,
|
|
|
- doc.version
|
|
|
- );
|
|
|
-
|
|
|
- let conflicts = op.conflictsAttributesWith( op2 );
|
|
|
-
|
|
|
- expect( conflicts ).to.be.true;
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'if it removes an attribute that is set by the other operation', () => {
|
|
|
- let op = new ChangeOperation(
|
|
|
- new Range( new Position( [ 0 ], root ), new Position( [ 1 ], root ) ),
|
|
|
- new Attribute( 'foo', 'old' ),
|
|
|
- null,
|
|
|
- doc.version
|
|
|
- );
|
|
|
-
|
|
|
- let op2 = new ChangeOperation(
|
|
|
- new Range( new Position( [ 0 ], root ), new Position( [ 1 ], root ) ),
|
|
|
- new Attribute( 'foo', 'old' ),
|
|
|
- new Attribute( 'foo', 'bar' ),
|
|
|
- doc.version
|
|
|
- );
|
|
|
-
|
|
|
- let conflicts = op.conflictsAttributesWith( op2 );
|
|
|
-
|
|
|
- expect( conflicts ).to.be.true;
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'if it sets different value than the other operation', () => {
|
|
|
- let op = new ChangeOperation(
|
|
|
- new Range( new Position( [ 0 ], root ), new Position( [ 1 ], root ) ),
|
|
|
- new Attribute( 'foo', 'old' ),
|
|
|
- new Attribute( 'foo', 'bar' ),
|
|
|
- doc.version
|
|
|
- );
|
|
|
-
|
|
|
- let op2 = new ChangeOperation(
|
|
|
- new Range( new Position( [ 0 ], root ), new Position( [ 1 ], root ) ),
|
|
|
- new Attribute( 'foo', 'old' ),
|
|
|
- new Attribute( 'foo', 'xyz' ),
|
|
|
- doc.version
|
|
|
- );
|
|
|
-
|
|
|
- let conflicts = op.conflictsAttributesWith( op2 );
|
|
|
-
|
|
|
- expect( conflicts ).to.be.true;
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'if it sets a value for an attribute that is being removed by the operation', () => {
|
|
|
- let op = new ChangeOperation(
|
|
|
- new Range( new Position( [ 0 ], root ), new Position( [ 1 ], root ) ),
|
|
|
- null,
|
|
|
- new Attribute( 'foo', 'bar' ),
|
|
|
- doc.version
|
|
|
- );
|
|
|
-
|
|
|
- let op2 = new ChangeOperation(
|
|
|
- new Range( new Position( [ 0 ], root ), new Position( [ 1 ], root ) ),
|
|
|
- new Attribute( 'foo', 'old' ),
|
|
|
- null,
|
|
|
- doc.version
|
|
|
- );
|
|
|
-
|
|
|
- let conflicts = op.conflictsAttributesWith( op2 );
|
|
|
-
|
|
|
- expect( conflicts ).to.be.true;
|
|
|
- } );
|
|
|
- } );
|
|
|
} );
|