Skip to content

Commit

Permalink
Merge branch 't/13080' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Jun 2, 2015
2 parents 303f15d + e776c78 commit 68643de
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -23,6 +23,7 @@ Fixed Issues:
* [#13140](http://dev.ckeditor.com/ticket/13140): Fixed: Error thrown when dropping a block widget right after itself.
* [#13176](http://dev.ckeditor.com/ticket/13176): [IE8] Fixed: Errors while drag&drop of embed widgets.
* [#13015](http://dev.ckeditor.com/ticket/13015): Fixed: Dropping image file on [Enhanced Image](http://ckeditor.com/addon/image2) causes page reload.
* [#13080](http://dev.ckeditor.com/ticket/13080): Fixed: Ugly notification when response has HTML content.
* [#13128](http://dev.ckeditor.com/ticket/13128): Fixed: Various issues regarding cloning IDs of elements:
* Fixed the default behavior of [`range.cloneContents()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.range-method-cloneContents), [`range.extractContents()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.range-method-extractContents) methods which now clone IDs similarly to their native counterparts.
* Added `cloneId` arguments to the above methods and [`range.splitBlock()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.range-method-splitBlock) and [`element.breakParent()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-breakParent). Mind the default values and special behavior in the `extracContents()` method.
Expand Down
4 changes: 2 additions & 2 deletions plugins/filetools/lang/en.js
Expand Up @@ -9,5 +9,5 @@ CKEDITOR.plugins.setLang( 'filetools', 'en', {
httpError403: 'HTTP error occurred during file uploading (403: Forbidden).',
httpError: 'HTTP error occurred during file uploading (error status: %1).',
noUrlError: 'Upload URL is not defined.',
responseError: 'Incorrect server response format: %1'
} );
responseError: 'Incorrect server response.'
} );
4 changes: 3 additions & 1 deletion plugins/filetools/plugin.js
Expand Up @@ -178,7 +178,9 @@
}
} catch ( err ) {
// Response parsing error.
data.message = fileLoader.lang.filetools.responseError.replace( '%1', xhr.responseText );
data.message = fileLoader.lang.filetools.responseError;
window.console && window.console.log( xhr.responseText );

evt.cancel();
}
}, null, null, 999 );
Expand Down
6 changes: 3 additions & 3 deletions tests/plugins/filetools/fileloader.js
Expand Up @@ -637,7 +637,7 @@
},

'test error incorrect response': function() {
editorMock.lang = { filetools: { responseError: 'responseError %1' } };
editorMock.lang = { filetools: { responseError: 'responseError' } };

var loader = new FileLoader( editorMock, testFile ),
observer = observeEvents( loader );
Expand All @@ -649,8 +649,8 @@
'uploading[uploading,name.png,0/0/82,-,-,-]',
'update[uploading,name.png,0/0/82,-,-,-]',
'update[uploading,name.png,41/0/82,-,-,-]',
'error[error,name.png,82/0/82,responseError incorrect,-,-]',
'update[error,name.png,82/0/82,responseError incorrect,-,-]' ] );
'error[error,name.png,82/0/82,responseError,-,-]',
'update[error,name.png,82/0/82,responseError,-,-]' ] );
} );

loader.upload( 'http:\/\/url\/' );
Expand Down
29 changes: 29 additions & 0 deletions tests/plugins/filetools/filetools.js
Expand Up @@ -170,6 +170,35 @@
sinon.stub( repository.loaders[ 1 ], 'isFinished' ).returns( true );

assert.isTrue( repository.isFinished(), '3/3' );
},

'test fileUploadResponse event': function() {
var log = window.console && sinon.stub( window.console, 'log' );

var message = 'Not a JSON';
var error = 'Error.';

// Mock.
var data = {
fileLoader: {
xhr: {
responseText: message
},

lang: {
filetools: {
responseError: error
}
}
}
};

this.editor.fire( 'fileUploadResponse', data );

log && log.restore();

assert.areEqual( data.message, error );
assert.isTrue( log ? log.calledWith( message ) : true );
}
} );
} )();

0 comments on commit 68643de

Please sign in to comment.