|
|
@@ -21,11 +21,10 @@ import RenameOperation from '../../../src/model/operation/renameoperation';
|
|
|
import NoOperation from '../../../src/model/operation/nooperation';
|
|
|
|
|
|
describe( 'transform', () => {
|
|
|
- let doc, root, op, nodeA, nodeB, expected, baseVersion;
|
|
|
+ let model, doc, root, op, nodeA, nodeB, expected, baseVersion;
|
|
|
|
|
|
beforeEach( () => {
|
|
|
- const model = new Model();
|
|
|
-
|
|
|
+ model = new Model();
|
|
|
doc = model.document;
|
|
|
root = doc.createRoot();
|
|
|
|
|
|
@@ -476,7 +475,7 @@ describe( 'transform', () => {
|
|
|
describe( 'by MarkerOperation', () => {
|
|
|
it( 'no position update', () => {
|
|
|
const newRange = new Range( new Position( root, [ 0, 2, 0 ] ), new Position( root, [ 0, 2, 4 ] ) );
|
|
|
- const transformBy = new MarkerOperation( 'name', null, newRange, doc.markers, baseVersion );
|
|
|
+ const transformBy = new MarkerOperation( 'name', null, newRange, model.markers, baseVersion );
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
@@ -1200,7 +1199,7 @@ describe( 'transform', () => {
|
|
|
describe( 'by MarkerOperation', () => {
|
|
|
it( 'no operation update', () => {
|
|
|
const newRange = new Range( new Position( root, [ 0, 2, 0 ] ), new Position( root, [ 0, 2, 8 ] ) );
|
|
|
- const transformBy = new MarkerOperation( 'name', null, newRange, doc.markers, baseVersion );
|
|
|
+ const transformBy = new MarkerOperation( 'name', null, newRange, model.markers, baseVersion );
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
@@ -1680,7 +1679,7 @@ describe( 'transform', () => {
|
|
|
describe( 'by MarkerOperation', () => {
|
|
|
it( 'no position update', () => {
|
|
|
const newRange = new Range( new Position( root, [ 0, 2, 0 ] ), new Position( root, [ 0, 2, 8 ] ) );
|
|
|
- const transformBy = new MarkerOperation( 'name', null, newRange, doc.markers, baseVersion );
|
|
|
+ const transformBy = new MarkerOperation( 'name', null, newRange, model.markers, baseVersion );
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
@@ -2887,7 +2886,7 @@ describe( 'transform', () => {
|
|
|
describe( 'by MarkerOperation', () => {
|
|
|
it( 'no position update', () => {
|
|
|
const newRange = new Range( new Position( root, [ 2, 2, 3 ] ), new Position( root, [ 2, 2, 8 ] ) );
|
|
|
- const transformBy = new MarkerOperation( 'name', null, newRange, doc.markers, baseVersion );
|
|
|
+ const transformBy = new MarkerOperation( 'name', null, newRange, model.markers, baseVersion );
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
@@ -3026,7 +3025,7 @@ describe( 'transform', () => {
|
|
|
describe( 'by MarkerOperation', () => {
|
|
|
it( 'no position update', () => {
|
|
|
const newRange = new Range( new Position( root, [ 0, 2, 0 ] ), new Position( root, [ 0, 2, 8 ] ) );
|
|
|
- const transformBy = new MarkerOperation( 'name', null, newRange, doc.markers, baseVersion );
|
|
|
+ const transformBy = new MarkerOperation( 'name', null, newRange, model.markers, baseVersion );
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
@@ -3150,7 +3149,7 @@ describe( 'transform', () => {
|
|
|
describe( 'by MarkerOperation', () => {
|
|
|
it( 'no operation update', () => {
|
|
|
const newRange = new Range( new Position( root, [ 0, 2, 0 ] ), new Position( root, [ 0, 2, 8 ] ) );
|
|
|
- const transformBy = new MarkerOperation( 'name', null, newRange, doc.markers, baseVersion );
|
|
|
+ const transformBy = new MarkerOperation( 'name', null, newRange, model.markers, baseVersion );
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
@@ -3319,7 +3318,7 @@ describe( 'transform', () => {
|
|
|
beforeEach( () => {
|
|
|
oldRange = Range.createFromParentsAndOffsets( root, 1, root, 4 );
|
|
|
newRange = Range.createFromParentsAndOffsets( root, 10, root, 12 );
|
|
|
- op = new MarkerOperation( 'name', oldRange, newRange, doc.markers, baseVersion );
|
|
|
+ op = new MarkerOperation( 'name', oldRange, newRange, model.markers, baseVersion );
|
|
|
|
|
|
expected = {
|
|
|
name: 'name',
|
|
|
@@ -3469,7 +3468,7 @@ describe( 'transform', () => {
|
|
|
|
|
|
describe( 'by MarkerOperation', () => {
|
|
|
it( 'different marker name: no operation update', () => {
|
|
|
- const transformBy = new MarkerOperation( 'otherName', oldRange, newRange, doc.markers, baseVersion );
|
|
|
+ const transformBy = new MarkerOperation( 'otherName', oldRange, newRange, model.markers, baseVersion );
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
@@ -3479,7 +3478,7 @@ describe( 'transform', () => {
|
|
|
|
|
|
it( 'same marker name and is important: convert to NoOperation', () => {
|
|
|
const anotherRange = Range.createFromParentsAndOffsets( root, 2, root, 2 );
|
|
|
- const transformBy = new MarkerOperation( 'name', oldRange, anotherRange, doc.markers, baseVersion );
|
|
|
+ const transformBy = new MarkerOperation( 'name', oldRange, anotherRange, model.markers, baseVersion );
|
|
|
|
|
|
const transOp = transform( op, transformBy );
|
|
|
|
|
|
@@ -3492,7 +3491,7 @@ describe( 'transform', () => {
|
|
|
|
|
|
it( 'same marker name and is less important: update oldRange parameter', () => {
|
|
|
const anotherRange = Range.createFromParentsAndOffsets( root, 2, root, 2 );
|
|
|
- const transformBy = new MarkerOperation( 'name', oldRange, anotherRange, doc.markers, baseVersion );
|
|
|
+ const transformBy = new MarkerOperation( 'name', oldRange, anotherRange, model.markers, baseVersion );
|
|
|
|
|
|
const transOp = transform( op, transformBy, { isStrong: true } );
|
|
|
|