diff --git a/CHANGES.md b/CHANGES.md index 2823c4a50d1..14b6564f1d5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,7 @@ New Features: * [#12448](http://dev.ckeditor.com/ticket/12448): Set of new methods, params and events giving the developer more control over HTML insertion. See the [`editable.insertHtml()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editable-method-insertHtml) param `range`, the [`editable.insertHtmlIntoRange()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editable-method-insertHtmlIntoRange) method and the [`editor.afterInsertHtml`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-afterInsertHtml) event. * [#12036](http://dev.ckeditor.com/ticket/12036): Initialize editor in [`readOnly`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-readOnly) mode when ` + \ No newline at end of file diff --git a/tests/plugins/image/manual/emptydimensions.md b/tests/plugins/image/manual/emptydimensions.md new file mode 100644 index 00000000000..ccddc7977be --- /dev/null +++ b/tests/plugins/image/manual/emptydimensions.md @@ -0,0 +1,19 @@ +@bender-tags: 4.5.0, tc +@bender-ui: collapsed +@bender-ckeditor-plugins: wysiwygarea, toolbar, floatingspace, image + +**Please note**: You can use such link: `http://lorempixel.com/200/100`. + +1. Open image dialog. +2. Set some proper image url and focus out. + * **Expected result**: Dimensions inputs should be empty. +3. Set another proper image url and focus out. + * **Expected result**: Again - dimensions inputs should be empty. + +---- + +1. Open image dialog. +2. Set some proper image url and focus out. +3. Click button "Reset Size". +4. Set some proper image url and focus out. + * **Expected result**: Dimensions inputs should be empty. \ No newline at end of file diff --git a/tests/plugins/image2/editing.js b/tests/plugins/image2/editing.js index d312e631b30..07d56d08958 100644 --- a/tests/plugins/image2/editing.js +++ b/tests/plugins/image2/editing.js @@ -20,7 +20,12 @@ '
' + 'yalt' + '
boo
' + - '
'; + '', + imgs = [ + { url: '%BASE_PATH%_assets/logo.png', width: '163', height: '61' }, + { url: '%BASE_PATH%_assets/large.jpg', width: '1008', height: '550' } + ], + downloadImage = bender.tools.downloadImage; function assertDialogFields( dialog, data ) { for ( var i in data ) @@ -106,6 +111,107 @@ }; assertWidgetDialog( editorBot, 'image', '', null, null, '

foo^bar

', onResume ); + }, + + /** + * #12126 + * + * 1. Open image2 dialog. + * 2. Set some proper image url and focus out. + * 3. Dimensions inputs should be empty. + * 4. Set another proper image url and focus out. + * 5. Again dimensions inputs should be empty. + */ + 'test dimensions not set automatically when disabled in option': function() { + bender.editorBot.create( { + name: 'editor_disabled_autodimensions', + creator: 'inline', + config: { + extraPlugins: 'image2', + image2_prefillDimensions: false + } + }, + function( bot ) { + bot.dialog( 'image', function( dialog ) { + var i = 0, + heightInput = dialog.getContentElement( 'info', 'height' ), + widthInput = dialog.getContentElement( 'info', 'width' ); + + dialog.setValueOf( 'info', 'src', imgs[ i ].url ); + downloadImage( imgs[ i ].url, onDownload ); + + function onDownload() { + resume( onResume ); + } + + function onResume() { + dialog.getContentElement( 'info', 'height' ).getValue(); + assert.areSame( '', widthInput.getValue() ); + assert.areSame( '', heightInput.getValue() ); + + if ( i === 0 ) { + dialog.setValueOf( 'info', 'src', imgs[ ++i ].url ); + downloadImage( imgs[ i ].url, onDownload ); + wait(); + } else { + dialog.hide(); + } + } + + wait(); + } ); + } ); + }, + + /** + * #12126 + * + * 1. Open image2 dialog. + * 2. Set some proper image url and focus out. + * 3. Click button "Reset Size". + * 4. Set some proper image url and focus out. + * 5. Dimensions inputs should be empty. + */ + 'test dimension should be empty after resetting size and loading image': function() { + bender.editorBot.create( { + name: 'editor_disabled_autodimensions2', + creator: 'inline', + config: { + extraPlugins: 'image2', + image2_prefillDimensions: false + } + }, + function( bot ) { + bot.dialog( 'image', function( dialog ) { + var i = 0, + resetBtn = bot.editor.document.getById( dialog.getContentElement( 'info', 'lock' ).domId ).find( '.cke_btn_reset' ).getItem( 0 ); + + dialog.setValueOf( 'info', 'src', imgs[ i ].url ); + downloadImage( imgs[ i ].url, onDownload ); + + function onDownload() { + resume( onResume ); + } + + function onResume() { + resetBtn.fire( 'click' ); + assert.areSame( imgs[ i ].width, dialog.getContentElement( 'info', 'width' ).getValue() ); + assert.areSame( imgs[ i ].height, dialog.getContentElement( 'info', 'height' ).getValue() ); + + dialog.setValueOf( 'info', 'src', imgs[ ++i ].url ); + downloadImage( imgs[ i ].url, function() { + resume( function() { + assert.areSame( '', dialog.getContentElement( 'info', 'width' ).getValue() ); + assert.areSame( '', dialog.getContentElement( 'info', 'height' ).getValue() ); + } ); + } ); + + wait(); + } + + wait(); + } ); + } ); } } ); } )(); \ No newline at end of file diff --git a/tests/plugins/image2/manual/emptydimensions.html b/tests/plugins/image2/manual/emptydimensions.html new file mode 100644 index 00000000000..e9344fa8dc1 --- /dev/null +++ b/tests/plugins/image2/manual/emptydimensions.html @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/tests/plugins/image2/manual/emptydimensions.md b/tests/plugins/image2/manual/emptydimensions.md new file mode 100644 index 00000000000..2e42b3666f6 --- /dev/null +++ b/tests/plugins/image2/manual/emptydimensions.md @@ -0,0 +1,19 @@ +@bender-tags: 4.5.0, tc +@bender-ui: collapsed +@bender-ckeditor-plugins: wysiwygarea, toolbar, floatingspace, image2 + +**Please note**: You can use such link: `http://lorempixel.com/200/100`. + +1. Open image dialog. +2. Set some proper image url and focus out. + * **Expected result**: Dimensions inputs should be empty. +3. Set another proper image url and focus out. + * **Expected result**: Again - dimensions inputs should be empty. + +---- + +1. Open image dialog. +2. Set some proper image url and focus out. +3. Click button "Reset Size". +4. Set some proper image url and focus out. + * **Expected result**: Dimensions inputs should be empty. \ No newline at end of file