Skip to content
Permalink
Browse files

Merge branch 't/13030' into major

  • Loading branch information...
Reinmar committed Apr 7, 2015
2 parents aba11da + 74ecd60 commit b0d867d677b5635b4e8eaecf1d8808e915b51367
@@ -174,7 +174,7 @@
evt.cancel();
} else {
data.fileName = response.fileName;
data.url = encodeURI( response.url );
data.url = response.url;
}
} catch ( err ) {
// Response parsing error.
Binary file not shown.
@@ -304,6 +304,30 @@
wait();
},

'test upload response not encoded (#13030)': function() {
var loader = new FileLoader( editorMock, pngBase64, 'na me.png' ),
observer = observeEvents( loader );

createXMLHttpRequestMock( [ 'progress', 'load' ], {
responseText: '{"fileName":"na me2.png","uploaded":1,"url":"http:\/\/url\/na me2.png"}'
} );

resumeAfter( loader, 'uploaded', function() {
observer.assert( [
'uploading[uploading,na me.png,0/82/82,-,data:image/png;base64,-]',
'update[uploading,na me.png,0/82/82,-,data:image/png;base64,-]',
'update[uploading,na me.png,41/82/82,-,data:image/png;base64,-]',
'uploaded[uploaded,na me2.png,82/82/82,-,data:image/png;base64,http://url/na me2.png]',
'update[uploaded,na me2.png,82/82/82,-,data:image/png;base64,http://url/na me2.png]' ] );
}, 3 );

loader.upload( 'http:\/\/url\/' );

assert.areSame( 'http:\/\/url\/', loader.uploadUrl );

wait();
},

'test loadAndUpload': function() {
var loader = new FileLoader( editorMock, testFile ),
observer = observeEvents( loader );
@@ -52,17 +52,20 @@ window.XMLHttpRequest = function() {
}
// If file is loaded call onload.
else {
clearInterval( interval );
xhr.status = 200;
xhr.responseText = JSON.stringify( {
var responseData = {
fileName: formData.getFileName(),
uploaded: 1,
url: '\/' + basePath + '_assets\/lena.jpg',
error: {
number: 201,
message: ''
}
} );
};
CKEDITOR.tools.extend( responseData, XMLHttpRequest.responseData, true );

clearInterval( interval );
xhr.status = 200;
xhr.responseText = JSON.stringify( responseData );
onload();
}
}, 400 );
@@ -73,4 +76,4 @@ window.XMLHttpRequest = function() {
this.onabort();
}
};
};
};
@@ -0,0 +1,13 @@
<div id="editor"></div>

<script>
CKEDITOR.replace( 'editor', {
imageUploadUrl: 'http://sub.ckeditor.dev/'
} );
// We are going to overwrite server response to have encoded one.
var basePath = bender.config.tests[ bender.testData.group ].basePath;
XMLHttpRequest.responseData = {
url: '\/' + basePath + '_assets\/le%20na.jpg'
};
</script>
@@ -0,0 +1,12 @@
@bender-tags: 4.5.0, tc
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, image2, uploadimage, toolbar
@bender-include: _helpers/xhr.js
**Ignore this test unless running Bender 0.2.3+.**
1. Drag and drop some image into editable.
**Expected result:** Image should be uploaded and you should see *Lena* **upside down**.
**Unexpected result:** After upload no *Lena* is shown.

0 comments on commit b0d867d

Please sign in to comment.
You can’t perform that action at this time.