Skip to content

Commit

Permalink
Merge branch 'master' into i/8640-bubbling-events
Browse files Browse the repository at this point in the history
  • Loading branch information
niegowski committed Mar 4, 2021
2 parents 78c0d63 + 7889576 commit bef0dd2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/ckeditor5-table/tests/tablekeyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2598,10 +2598,10 @@ describe( 'TableKeyboard', () => {
] ) );
} );

it( 'should not move the caret if it\'s just before the last space in the line next to last one', () => {
it( 'should not move the caret if it\'s 2 characters before the last space in the line next to last one', () => {
setModelData( model, modelTable( [
[ '00', '01', '02' ],
[ '10', text.substring( 0, text.length - 1 ) + '[]d word word word', '12' ],
[ '10', text.substring( 0, text.length - 2 ) + '[]od word word word', '12' ],
[ '20', '21', '22' ]
] ) );

Expand Down
20 changes: 17 additions & 3 deletions packages/ckeditor5-widget/tests/verticalnavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import HorizontalLine from '@ckeditor/ckeditor5-horizontal-line/src/horizontalli
import Image from '@ckeditor/ckeditor5-image/src/image';
import ImageCaption from '@ckeditor/ckeditor5-image/src/imagecaption';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';

import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard';
import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
Expand All @@ -30,7 +31,7 @@ describe( 'Widget - vertical keyboard navigation near widgets', () => {
global.document.body.appendChild( editorElement );

editor = await ClassicTestEditor.create( editorElement, {
plugins: [ Paragraph, Image, ImageCaption, HorizontalLine, BlockQuote, BlockWidgetWithNestedEditable ]
plugins: [ Paragraph, Image, ImageCaption, HorizontalLine, BlockQuote, Bold, BlockWidgetWithNestedEditable ]
} );

model = editor.model;
Expand Down Expand Up @@ -639,6 +640,19 @@ describe( 'Widget - vertical keyboard navigation near widgets', () => {
sinon.assert.notCalled( upArrowDomEvtDataStub.stopPropagation );
} );

it( 'should not prevent default browser behavior if caret is in the middle line of a text with formatting', () => {
setModelData( model,
'<widget><nested><paragraph>' +
'word word word[] word <$text bold="true">bolded</$text> word ' + text +
'</paragraph></nested></widget>'
);

editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub );

sinon.assert.notCalled( downArrowDomEvtDataStub.preventDefault );
sinon.assert.notCalled( downArrowDomEvtDataStub.stopPropagation );
} );

it( 'should move caret to beginning of nested editable content if caret is in the first line of a text', () => {
setModelData( model, `<widget><nested><paragraph>${ 'word[] word' + text }</paragraph></nested></widget>` );

Expand Down Expand Up @@ -801,10 +815,10 @@ describe( 'Widget - vertical keyboard navigation near widgets', () => {
);
} );

it( 'should not move the caret if it\'s just before the last space in the line next to last one', () => {
it( 'should not move the caret if it\'s 2 characters before the last space in the line next to last one', () => {
setModelData( model,
'<widget><nested><paragraph>' +
text.substring( 0, text.length - 1 ) + '[]d word word word' +
text.substring( 0, text.length - 2 ) + '[]rd word word word' +
'</paragraph></nested></widget>'
);

Expand Down

0 comments on commit bef0dd2

Please sign in to comment.