-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mateusz Samsel
committed
Dec 18, 2017
1 parent
4db9cc5
commit c3c075b
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<textarea id="classic"> | ||
|
||
</textarea> | ||
|
||
<div id="output" style="background-color:lightgreen;"></div> | ||
|
||
<script> | ||
var xhr, requests; | ||
|
||
CKEDITOR.on( 'instanceLoaded', function() { | ||
if ( !CKEDITOR.fileTools.isFileUploadSupported ) { | ||
bender.ignore(); | ||
} else { | ||
// Mock XHR | ||
xhr = sinon.useFakeXMLHttpRequest(); | ||
requests = []; | ||
xhr.onCreate = function( xhr ) { | ||
requests.push( xhr ); | ||
}; | ||
window.onunload = function() { | ||
xhr.restore(); | ||
server.restore(); | ||
} | ||
} | ||
} ); | ||
|
||
var classic = CKEDITOR.replace( 'classic', { | ||
xmlHttpRequestHeaders: { | ||
'hello': 'world', | ||
'foo': 'bar' | ||
}, | ||
filebrowserUploadUrl: 'fake-url' | ||
} ); | ||
|
||
// Display XHR details when CKEDITOR process entire request. | ||
classic.on( 'fileUploadRequest', function( evt ) { | ||
var output = document.getElementById( 'output' ); | ||
var outputString = CKEDITOR.tools.array.reduce( requests, function( acc, item ) { | ||
var line = ''; | ||
for ( header in item.requestHeaders ) { | ||
if ( item.requestHeaders.hasOwnProperty( header ) ) { | ||
line += '| <code>header: ' + header + ', value: ' + item.requestHeaders[ header ] + '</code> |'; | ||
} | ||
} | ||
acc += '<li>' + line + '</li>'; | ||
return acc; | ||
}, '' ); | ||
output.innerHTML = '<ol>' + outputString + '</ol>'; | ||
}, null, null, 1000 ) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@bender-tags: 4.8.1, feature, tp3117 | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: wysiwygarea, toolbar, filebrowser, filetools, image, link, flash | ||
|
||
---- | ||
1. Open image dialog | ||
2. Go to upload tab | ||
3. Select some image and send it to server | ||
4. Close dialog (There might appear warning that image url is not set up) | ||
|
||
Repeat those steps for Link and Flash plugin. | ||
|
||
_Note:_ When new upload request is made, it should be visible as separate line below. | ||
|
||
**Expected:** Below editor will appear green div with listed headers attempted to send. There are 2 headers in single line: | ||
`hello: world, foo: bar`. | ||
|
||
**Unexpected:** Headers are not listed below. |