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

Commit

Permalink
Merge branch 'master' into t/ckeditor5/1120
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Sep 4, 2018
2 parents 785efd2 + facc882 commit 4ae6a99
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 39 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
sudo: required
dist: trusty
addons:
firefox: "latest"
firefox: latest
apt:
sources:
- google-chrome
packages:
- 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
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This package implements the <kbd>Enter</kbd> and <kbd>Shift</kbd>+<kbd>Enter</kb

## Documentation

See the [`@ckeditor/ckeditor5-enter` package](https://docs.ckeditor.com/ckeditor5/latest/api/enter.html) page in [CKEditor 5 documentation](https://docs.ckeditor.com/ckeditor5/latest/).
See the [`@ckeditor/ckeditor5-enter` package](https://ckeditor.com/docs/ckeditor5/latest/api/enter.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/).

## License

Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ckeditor/ckeditor5-enter",
"version": "10.1.0",
"version": "10.1.1",
"description": "Enter feature for CKEditor 5.",
"keywords": [
"ckeditor",
Expand All @@ -9,24 +9,24 @@
"ckeditor5-feature"
],
"dependencies": {
"@ckeditor/ckeditor5-core": "^10.1.0",
"@ckeditor/ckeditor5-engine": "^10.1.0",
"@ckeditor/ckeditor5-utils": "^10.1.0"
"@ckeditor/ckeditor5-core": "^11.0.0",
"@ckeditor/ckeditor5-engine": "^10.2.0",
"@ckeditor/ckeditor5-utils": "^10.2.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-basic-styles": "^10.0.1",
"@ckeditor/ckeditor5-editor-classic": "^10.0.1",
"@ckeditor/ckeditor5-heading": "^10.0.1",
"@ckeditor/ckeditor5-paragraph": "^10.0.1",
"@ckeditor/ckeditor5-typing": "^10.0.1",
"@ckeditor/ckeditor5-undo": "^10.0.1",
"@ckeditor/ckeditor5-basic-styles": "^10.0.2",
"@ckeditor/ckeditor5-editor-classic": "^11.0.0",
"@ckeditor/ckeditor5-heading": "^10.0.2",
"@ckeditor/ckeditor5-paragraph": "^10.0.2",
"@ckeditor/ckeditor5-typing": "^11.0.0",
"@ckeditor/ckeditor5-undo": "^10.0.2",
"eslint": "^4.15.0",
"eslint-config-ckeditor5": "^1.0.7",
"husky": "^0.14.3",
"lint-staged": "^7.0.0"
},
"engines": {
"node": ">=6.0.0",
"node": ">=6.9.0",
"npm": ">=3.0.0"
},
"author": "CKSource (http://cksource.com/)",
Expand Down
18 changes: 9 additions & 9 deletions tests/entercommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -50,30 +50,30 @@ describe( 'EnterCommand', () => {
setData( model, '<p>foo[]</p>' );

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, '<p>[]foo</p>' );

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, '<p>foo[]</p>' );

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 );
} );
} );

Expand Down
42 changes: 26 additions & 16 deletions tests/shiftentercommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -49,30 +49,30 @@ describe( 'ShiftEnterCommand', () => {
setData( model, '<p>foo[]</p>' );

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, '<p>[]foo</p>' );

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, '<p>foo[]</p>' );

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 );
} );
} );

Expand Down Expand Up @@ -295,7 +295,7 @@ describe( 'ShiftEnterCommand', () => {
model.change( () => {
setData( model, '<p><inlineLimit>F[oo.</inlineLimit>B]ar.</p>' );

// 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 );
Expand All @@ -307,7 +307,7 @@ describe( 'ShiftEnterCommand', () => {
model.change( () => {
setData( model, '<p>F[oo<inlineLimit>Bar].</inlineLimit></p>' );

// 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 );
Expand All @@ -319,23 +319,33 @@ describe( 'ShiftEnterCommand', () => {
model.change( () => {
setData( model, '<img>[]</img>' );

// 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 );
} );
} );

it( 'should be disabled for non-collapsed selection which starts in element inside a block limit element', () => {
setData( model, '<blockLimit><p>F[oo.</p></blockLimit><p>B]ar.</p>' );
model.change( () => {
setData( model, '<blockLimit><p>F[oo.</p></blockLimit><p>B]ar.</p>' );

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, '<p>Fo[o.</p><blockLimit><p>Bar].</p></blockLimit>' );
model.change( () => {
setData( model, '<p>Fo[o.</p><blockLimit><p>Bar].</p></blockLimit>' );

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)', () => {
Expand Down

0 comments on commit 4ae6a99

Please sign in to comment.