diff --git a/.travis.yml b/.travis.yml index 28800cb..3ce6c83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ sudo: required dist: trusty addons: - firefox: "latest" + firefox: latest apt: sources: - google-chrome @@ -9,12 +9,14 @@ addons: - google-chrome-stable language: node_js node_js: -- '6' +- '8' cache: - node_modules before_install: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start +- npm config set package-lock false +- npm i -g npm@^5.7.1 install: - npm install @ckeditor/ckeditor5-dev-tests - ckeditor5-dev-tests-install-dependencies diff --git a/CHANGELOG.md b/CHANGELOG.md index 7341852..7909aba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========= +## [10.1.1](https://github.com/ckeditor/ckeditor5-enter/compare/v10.1.0...v10.1.1) (2018-07-18) + +Internal changes only (updated dependencies, documentation, etc.). + + ## [10.1.0](https://github.com/ckeditor/ckeditor5-enter/compare/v10.0.0...v10.1.0) (2018-06-21) ### Features diff --git a/README.md b/README.md index d987ea3..b1b426f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This package implements the Enter and Shift+Enter=6.0.0", + "node": ">=6.9.0", "npm": ">=3.0.0" }, "author": "CKSource (http://cksource.com/)", diff --git a/tests/entercommand.js b/tests/entercommand.js index b6e5314..0a98f5e 100644 --- a/tests/entercommand.js +++ b/tests/entercommand.js @@ -5,7 +5,7 @@ import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor'; import EnterCommand from '../src/entercommand'; -import InsertDelta from '@ckeditor/ckeditor5-engine/src/model/delta/insertdelta'; +import InsertOperation from '@ckeditor/ckeditor5-engine/src/model/operation/insertoperation'; import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; describe( 'EnterCommand', () => { @@ -50,30 +50,30 @@ describe( 'EnterCommand', () => { setData( model, '

foo[]

' ); model.change( writer => { - expect( writer.batch.deltas ).to.length( 0 ); + expect( writer.batch.operations ).to.length( 0 ); editor.execute( 'enter' ); - expect( writer.batch.deltas ).to.length.above( 0 ); + expect( writer.batch.operations ).to.length.above( 0 ); } ); } ); - it( 'creates InsertDelta if enter is at the beginning of block', () => { + it( 'creates InsertOperation if enter is at the beginning of block', () => { setData( model, '

[]foo

' ); editor.execute( 'enter' ); - const deltas = Array.from( doc.history.getDeltas() ); + const ops = doc.history.getOperations(); - expect( deltas[ deltas.length - 1 ] ).to.be.instanceof( InsertDelta ); + expect( ops[ ops.length - 1 ] ).to.be.instanceof( InsertOperation ); } ); - it( 'creates InsertDelta if enter is at the end of block', () => { + it( 'creates InsertOperation if enter is at the end of block', () => { setData( model, '

foo[]

' ); editor.execute( 'enter' ); - const deltas = Array.from( doc.history.getDeltas() ); + const operations = Array.from( doc.history.getOperations() ); - expect( deltas[ deltas.length - 1 ] ).to.be.instanceof( InsertDelta ); + expect( operations[ operations.length - 1 ] ).to.be.instanceof( InsertOperation ); } ); } ); diff --git a/tests/shiftentercommand.js b/tests/shiftentercommand.js index 26bbb17..42ace28 100644 --- a/tests/shiftentercommand.js +++ b/tests/shiftentercommand.js @@ -4,7 +4,7 @@ */ import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor'; -import InsertDelta from '@ckeditor/ckeditor5-engine/src/model/delta/insertdelta'; +import InsertOperation from '@ckeditor/ckeditor5-engine/src/model/operation/insertoperation'; import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; import ShiftEnter from '../src/shiftenter'; @@ -49,30 +49,30 @@ describe( 'ShiftEnterCommand', () => { setData( model, '

foo[]

' ); model.change( writer => { - expect( writer.batch.deltas ).to.length( 0 ); + expect( writer.batch.operations ).to.length( 0 ); editor.execute( 'shiftEnter' ); - expect( writer.batch.deltas ).to.length.above( 0 ); + expect( writer.batch.operations ).to.length.above( 0 ); } ); } ); - it( 'creates InsertDelta if soft enter is at the beginning of block', () => { + it( 'creates InsertOperation if soft enter is at the beginning of block', () => { setData( model, '

[]foo

' ); editor.execute( 'shiftEnter' ); - const deltas = Array.from( doc.history.getDeltas() ); + const operations = Array.from( doc.history.getOperations() ); - expect( deltas[ deltas.length - 1 ] ).to.be.instanceof( InsertDelta ); + expect( operations[ operations.length - 1 ] ).to.be.instanceof( InsertOperation ); } ); - it( 'creates InsertDelta if soft enter is at the end of block', () => { + it( 'creates InsertOperation if soft enter is at the end of block', () => { setData( model, '

foo[]

' ); editor.execute( 'shiftEnter' ); - const deltas = Array.from( doc.history.getDeltas() ); + const operations = Array.from( doc.history.getOperations() ); - expect( deltas[ deltas.length - 1 ] ).to.be.instanceof( InsertDelta ); + expect( operations[ operations.length - 1 ] ).to.be.instanceof( InsertOperation ); } ); } ); @@ -295,7 +295,7 @@ describe( 'ShiftEnterCommand', () => { model.change( () => { setData( model, '

F[oo.B]ar.

' ); - // Enforce command refresh because of 'transparent' batch. + // Refresh it manually because we're in the middle of a change block. command.refresh(); expect( command.isEnabled ).to.equal( false ); @@ -307,7 +307,7 @@ describe( 'ShiftEnterCommand', () => { model.change( () => { setData( model, '

F[ooBar].

' ); - // Enforce command refresh because of 'transparent' batch. + // Refresh it manually because we're in the middle of a change block. command.refresh(); expect( command.isEnabled ).to.equal( false ); @@ -319,7 +319,7 @@ describe( 'ShiftEnterCommand', () => { model.change( () => { setData( model, '[]' ); - // Enforce command refresh because of 'transparent' batch. + // Refresh it manually because we're in the middle of a change block. command.refresh(); expect( command.isEnabled ).to.equal( false ); @@ -327,15 +327,25 @@ describe( 'ShiftEnterCommand', () => { } ); it( 'should be disabled for non-collapsed selection which starts in element inside a block limit element', () => { - setData( model, '

F[oo.

B]ar.

' ); + model.change( () => { + setData( model, '

F[oo.

B]ar.

' ); - expect( command.isEnabled ).to.equal( false ); + // Refresh it manually because we're in the middle of a change block. + command.refresh(); + + expect( command.isEnabled ).to.equal( false ); + } ); } ); it( 'should be disabled for non-collapsed selection which ends in element inside a block limit element', () => { - setData( model, '

Fo[o.

Bar].

' ); + model.change( () => { + setData( model, '

Fo[o.

Bar].

' ); - expect( command.isEnabled ).to.equal( false ); + // Refresh it manually because we're in the middle of a change block. + command.refresh(); + + expect( command.isEnabled ).to.equal( false ); + } ); } ); it( 'should be disabled for multi-ranges selection (1)', () => {