|
@@ -539,7 +539,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedBy( 2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedBy( 2 ),
|
|
|
|
|
+ expected.range.end
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -554,7 +557,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedBy( 2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedBy( 2 ),
|
|
|
|
|
+ expected.range.end
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -582,8 +588,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = getPositionMovedInPath( expected.range.start, 0, 2 );
|
|
|
|
|
- expected.range.end = getPositionMovedInPath( expected.range.end, 0, 2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ getPositionMovedInPath( expected.range.start, 0, 2 ),
|
|
|
|
|
+ getPositionMovedInPath( expected.range.end, 0, 2 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -613,12 +621,17 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 1, 3, 3 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 1, 3, 3 ] ),
|
|
|
|
|
+ expected.range.end
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = op.range.start;
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 1, 3, 1 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ op.range.start,
|
|
|
|
|
+ new Position( expected.range.end.root, [ 1, 3, 1 ] )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
@@ -730,12 +743,18 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 1, 4, 2 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start,
|
|
|
|
|
+ new Position( expected.range.end.root, [ 1, 4, 2 ] )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 1, 4, 2 ] );
|
|
|
|
|
- expected.range.end = op.range.end;
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 1, 4, 2 ] ),
|
|
|
|
|
+ op.range.end
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
expected.oldValue = 'another';
|
|
expected.oldValue = 'another';
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
@@ -756,12 +775,17 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 2, 1 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 2, 1 ] ),
|
|
|
|
|
+ expected.range.end
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = op.range.start;
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 2, 1 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ op.range.start,
|
|
|
|
|
+ new Position( expected.range.end.root, [ 2, 1 ] )
|
|
|
|
|
+ );
|
|
|
expected.oldValue = null;
|
|
expected.oldValue = null;
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
@@ -781,18 +805,26 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 3 );
|
|
expect( transOp.length ).to.equal( 3 );
|
|
|
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 1, 4, 1 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start,
|
|
|
|
|
+ new Position( expected.range.end.root, [ 1, 4, 1 ] )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 2, 1 ] );
|
|
|
|
|
- expected.range.end = op.range.end;
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 2, 1 ] ),
|
|
|
|
|
+ op.range.end
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 1, 4, 1 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 2, 1 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 1, 4, 1 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 2, 1 ] )
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
expected.oldValue = null;
|
|
expected.oldValue = null;
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
@@ -867,7 +899,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 1, 4, 2 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start,
|
|
|
|
|
+ new Position( expected.range.end.root, [ 1, 4, 2 ] )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -885,7 +920,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 2, 1 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 2, 1 ] ),
|
|
|
|
|
+ expected.range.end
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -904,12 +942,17 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 1, 4, 1 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start,
|
|
|
|
|
+ new Position( expected.range.end.root, [ 1, 4, 1 ] )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 2, 1 ] );
|
|
|
|
|
- expected.range.end = op.range.end;
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 2, 1 ] ),
|
|
|
|
|
+ op.range.end
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
@@ -959,7 +1002,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedBy( -2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedBy( -2 ),
|
|
|
|
|
+ expected.range.end
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -975,7 +1021,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedBy( 2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedBy( 2 ),
|
|
|
|
|
+ expected.range.end
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -991,8 +1040,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = getPositionMovedInPath( expected.range.start, 0, -1 );
|
|
|
|
|
- expected.range.end = getPositionMovedInPath( expected.range.end, 0, -1 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ getPositionMovedInPath( expected.range.start, 0, -1 ),
|
|
|
|
|
+ getPositionMovedInPath( expected.range.end, 0, -1 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -1022,7 +1073,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = getPositionMovedInPath( expected.range.start, 1, 2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ getPositionMovedInPath( expected.range.start, 1, 2 ),
|
|
|
|
|
+ expected.range.end
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -1054,12 +1108,17 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 2, 1 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start,
|
|
|
|
|
+ new Position( expected.range.end.root, [ 2, 1 ] )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 4 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 5, 4 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 4 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 5, 4 ] )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
@@ -1077,12 +1136,17 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 1, 1 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 1, 1 ] ),
|
|
|
|
|
+ expected.range.end
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 0, 1 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 0, 3 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 0, 1 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 0, 3 ] )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
@@ -1098,8 +1162,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 1, 4, 1, 2 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 1, 4, 2, 2, 4 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 1, 4, 1, 2 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 1, 4, 2, 2, 4 ] )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -1119,8 +1185,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 3, 2 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 3, 4 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 3, 2 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 3, 4 ] )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
@@ -1138,12 +1206,17 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 1, 6 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 1, 6 ] ),
|
|
|
|
|
+ expected.range.end
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = op.range.start;
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 1, 4 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ op.range.start,
|
|
|
|
|
+ new Position( expected.range.end.root, [ 1, 4 ] )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
@@ -1161,19 +1234,25 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 3 );
|
|
expect( transOp.length ).to.equal( 3 );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 5 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 5, 2, 4 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 5 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 5, 2, 4 ] )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 1, 1 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 2 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 1, 1 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 2 ] )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 3 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 5 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 3 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 5 ] )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 2 ], expected );
|
|
expectOperation( transOp[ 2 ], expected );
|
|
@@ -1241,8 +1320,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedBy( 2 );
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedBy( 2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedBy( 2 ),
|
|
|
|
|
+ expected.range.end.getShiftedBy( 2 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -1257,8 +1338,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedBy( 2 );
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedBy( 2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedBy( 2 ),
|
|
|
|
|
+ expected.range.end.getShiftedBy( 2 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -1276,8 +1359,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedBy( -1 );
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedBy( -1 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedBy( -1 ),
|
|
|
|
|
+ expected.range.end.getShiftedBy( -1 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -1293,8 +1378,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedBy( 2 );
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedBy( 2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedBy( 2 ),
|
|
|
|
|
+ expected.range.end.getShiftedBy( 2 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -1312,12 +1399,17 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedBy( -2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start,
|
|
|
|
|
+ expected.range.end.getShiftedBy( -2 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 2, 4, 1 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 2, 4, 3 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 2, 4, 1 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 2, 4, 3 ] )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
@@ -1335,13 +1427,17 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedBy( -1 );
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedBy( -2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedBy( -1 ),
|
|
|
|
|
+ expected.range.end.getShiftedBy( -2 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 2, 4, 2 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 2, 4, 3 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 2, 4, 2 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 2, 4, 3 ] )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
@@ -1357,8 +1453,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 2, 4, 2, 1 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 2, 4, 2, 4 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 2, 4, 2, 1 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 2, 4, 2, 4 ] )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -1376,12 +1474,17 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedBy( -1 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start,
|
|
|
|
|
+ expected.range.end.getShiftedBy( -1 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 2, 4, 1 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 2, 4, 2 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 2, 4, 1 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 2, 4, 2 ] )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
@@ -1397,8 +1500,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 2, 4, 1 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 2, 4, 4 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 2, 4, 1 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 2, 4, 4 ] )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -1416,13 +1521,17 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 2 );
|
|
expect( transOp.length ).to.equal( 2 );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedTo( 4 );
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedTo( 6 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedTo( 4 ),
|
|
|
|
|
+ expected.range.end.getShiftedTo( 6 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedTo( op.range.start.offset );
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedTo( 2 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedTo( op.range.start.offset ),
|
|
|
|
|
+ expected.range.end.getShiftedTo( 2 )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
@@ -1440,19 +1549,25 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 3 );
|
|
expect( transOp.length ).to.equal( 3 );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedTo( 3 );
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedTo( 4 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedTo( 3 ),
|
|
|
|
|
+ expected.range.end.getShiftedTo( 4 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedTo( 0 );
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedTo( 1 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedTo( 0 ),
|
|
|
|
|
+ expected.range.end.getShiftedTo( 1 )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 1 ], expected );
|
|
expectOperation( transOp[ 1 ], expected );
|
|
|
|
|
|
|
|
- expected.range.start = expected.range.start.getShiftedTo( 2 );
|
|
|
|
|
- expected.range.end = expected.range.end.getShiftedTo( 3 );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ expected.range.start.getShiftedTo( 2 ),
|
|
|
|
|
+ expected.range.end.getShiftedTo( 3 )
|
|
|
|
|
+ );
|
|
|
expected.baseVersion++;
|
|
expected.baseVersion++;
|
|
|
|
|
|
|
|
expectOperation( transOp[ 2 ], expected );
|
|
expectOperation( transOp[ 2 ], expected );
|
|
@@ -1486,8 +1601,10 @@ describe( 'transform', () => {
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
|
|
|
|
|
- expected.range.start = new Position( expected.range.start.root, [ 4, 0 ] );
|
|
|
|
|
- expected.range.end = new Position( expected.range.end.root, [ 4, 4 ] );
|
|
|
|
|
|
|
+ expected.range = new Range(
|
|
|
|
|
+ new Position( expected.range.start.root, [ 4, 0 ] ),
|
|
|
|
|
+ new Position( expected.range.end.root, [ 4, 4 ] )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
|
} );
|
|
} );
|
|
@@ -3342,8 +3459,10 @@ describe( 'transform', () => {
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
expected.newRange = null;
|
|
expected.newRange = null;
|
|
|
- expected.oldRange.start = expected.oldRange.start.getShiftedTo( 3 );
|
|
|
|
|
- expected.oldRange.end = expected.oldRange.end.getShiftedTo( 6 );
|
|
|
|
|
|
|
+ expected.oldRange = new Range(
|
|
|
|
|
+ expected.oldRange.start.getShiftedTo( 3 ),
|
|
|
|
|
+ expected.oldRange.end.getShiftedTo( 6 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -3357,8 +3476,10 @@ describe( 'transform', () => {
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
expected.oldRange = null;
|
|
expected.oldRange = null;
|
|
|
- expected.newRange.start = expected.newRange.start.getShiftedTo( 12 );
|
|
|
|
|
- expected.newRange.end = expected.newRange.end.getShiftedTo( 14 );
|
|
|
|
|
|
|
+ expected.newRange = new Range(
|
|
|
|
|
+ expected.newRange.start.getShiftedTo( 12 ),
|
|
|
|
|
+ expected.newRange.end.getShiftedTo( 14 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -3394,8 +3515,10 @@ describe( 'transform', () => {
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
expected.newRange = null;
|
|
expected.newRange = null;
|
|
|
- expected.oldRange.start = expected.oldRange.start.getShiftedTo( 0 );
|
|
|
|
|
- expected.oldRange.end = expected.oldRange.end.getShiftedTo( 3 );
|
|
|
|
|
|
|
+ expected.oldRange = new Range(
|
|
|
|
|
+ expected.oldRange.start.getShiftedTo( 0 ),
|
|
|
|
|
+ expected.oldRange.end.getShiftedTo( 3 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -3405,10 +3528,14 @@ describe( 'transform', () => {
|
|
|
const transformBy = new MoveOperation( Position.createAt( root, 2 ), 2, Position.createAt( root, 20 ), baseVersion );
|
|
const transformBy = new MoveOperation( Position.createAt( root, 2 ), 2, Position.createAt( root, 20 ), baseVersion );
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.oldRange.start = expected.oldRange.start.getShiftedTo( 1 );
|
|
|
|
|
- expected.oldRange.end = expected.oldRange.end.getShiftedTo( 2 );
|
|
|
|
|
- expected.newRange.start = expected.newRange.start.getShiftedTo( 8 );
|
|
|
|
|
- expected.newRange.end = expected.newRange.end.getShiftedTo( 10 );
|
|
|
|
|
|
|
+ expected.oldRange = new Range(
|
|
|
|
|
+ expected.oldRange.start.getShiftedTo( 1 ),
|
|
|
|
|
+ expected.oldRange.end.getShiftedTo( 2 )
|
|
|
|
|
+ );
|
|
|
|
|
+ expected.newRange = new Range(
|
|
|
|
|
+ expected.newRange.start.getShiftedTo( 8 ),
|
|
|
|
|
+ expected.newRange.end.getShiftedTo( 10 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -3422,8 +3549,10 @@ describe( 'transform', () => {
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
expected.oldRange = null;
|
|
expected.oldRange = null;
|
|
|
- expected.newRange.start = expected.newRange.start.getShiftedTo( 10 );
|
|
|
|
|
- expected.newRange.end = expected.newRange.end.getShiftedTo( 14 );
|
|
|
|
|
|
|
+ expected.newRange = new Range(
|
|
|
|
|
+ expected.newRange.start.getShiftedTo( 10 ),
|
|
|
|
|
+ expected.newRange.end.getShiftedTo( 14 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|
|
@@ -3433,10 +3562,14 @@ describe( 'transform', () => {
|
|
|
const transformBy = new MoveOperation( Position.createAt( root, 20 ), 4, Position.createAt( root, 2 ), baseVersion );
|
|
const transformBy = new MoveOperation( Position.createAt( root, 20 ), 4, Position.createAt( root, 2 ), baseVersion );
|
|
|
const transOp = transform( op, transformBy );
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
|
|
- expected.oldRange.start = expected.oldRange.start.getShiftedTo( 1 );
|
|
|
|
|
- expected.oldRange.end = expected.oldRange.end.getShiftedTo( 8 );
|
|
|
|
|
- expected.newRange.start = expected.newRange.start.getShiftedTo( 14 );
|
|
|
|
|
- expected.newRange.end = expected.newRange.end.getShiftedTo( 16 );
|
|
|
|
|
|
|
+ expected.oldRange = new Range(
|
|
|
|
|
+ expected.oldRange.start.getShiftedTo( 1 ),
|
|
|
|
|
+ expected.oldRange.end.getShiftedTo( 8 )
|
|
|
|
|
+ );
|
|
|
|
|
+ expected.newRange = new Range(
|
|
|
|
|
+ expected.newRange.start.getShiftedTo( 14 ),
|
|
|
|
|
+ expected.newRange.end.getShiftedTo( 16 )
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
expect( transOp.length ).to.equal( 1 );
|
|
expect( transOp.length ).to.equal( 1 );
|
|
|
expectOperation( transOp[ 0 ], expected );
|
|
expectOperation( transOp[ 0 ], expected );
|