Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Fixed: remove _range property from json object returned by `Attribute…
Browse files Browse the repository at this point in the history
…Delta#toJSON`.
  • Loading branch information
scofalik committed May 16, 2017
1 parent b1a7b72 commit 0461cb1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/model/delta/attributedelta.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ export default class AttributeDelta extends Delta {
return AttributeDelta;
}

/**
* @inheritDoc
*/
toJSON() {
const json = super.toJSON();

delete json._range;

return json;
}

/**
* @inheritDoc
*/
Expand Down
7 changes: 7 additions & 0 deletions tests/model/delta/attributedelta.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Element from '../../../src/model/element';
import AttributeDelta from '../../../src/model/delta/attributedelta';
import { RootAttributeDelta } from '../../../src/model/delta/attributedelta';
import AttributeOperation from '../../../src/model/operation/attributeoperation';
import { jsonParseStringify } from '../../../tests/model/_utils/utils';

describe( 'Batch', () => {
let batch, doc, root;
Expand Down Expand Up @@ -507,6 +508,12 @@ describe( 'AttributeDelta', () => {
it( 'should provide proper className', () => {
expect( AttributeDelta.className ).to.equal( 'engine.model.delta.AttributeDelta' );
} );

it( 'should not have _range property when converted to JSON', () => {
const json = jsonParseStringify( delta );

expect( json ).not.to.have.property( '_range' );
} );
} );

describe( 'RootAttributeDelta', () => {
Expand Down

0 comments on commit 0461cb1

Please sign in to comment.