Skip to content
Permalink
Browse files

Merge branch 't/13158' into major

  • Loading branch information...
Reinmar committed May 4, 2015
2 parents 3127f92 + df6b3a0 commit 24d1c51f68ff8f7a074f1ebfaa74ac4fd483166d
Showing with 66 additions and 4 deletions.
  1. +1 −0 CHANGES.md
  2. +4 −2 plugins/widget/plugin.js
  3. +42 −2 tests/plugins/widget/editing.js
  4. +7 −0 tests/tickets/13158/1.html
  5. +12 −0 tests/tickets/13158/1.md
@@ -6,6 +6,7 @@ CKEditor 4 Changelog
Fixed Issues:

* [#13118](http://dev.ckeditor.com/ticket/13118): Fixed: The [`editor.getSelectedHtml()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-getSelectedHtml) method throws error when called in the source mode.
* [#13158](http://dev.ckeditor.com/ticket/13158): Fixed: Error after canceling dialog when creating a widget.
* Toolbar configurators:
* [#13185](http://dev.ckeditor.com/ticket/13185): Fixed: Wrong position of the suggestion box if there is not enough space below the caret.
* [#13138](http://dev.ckeditor.com/ticket/13138): Fixed: The "Toggle empty elements" button label is unclear.
@@ -1814,8 +1814,10 @@
// Finalize creation AFTER (20) new data was set.
okListener = dialog.once( 'ok', finalizeCreation, null, null, 20 );

cancelListener = dialog.once( 'cancel', function() {
editor.widgets.destroy( instance, true );
cancelListener = dialog.once( 'cancel', function( evt ) {
if ( !( evt.data && evt.data.hide === false ) ) {
editor.widgets.destroy( instance, true );
}
} );

dialog.once( 'hide', function() {
@@ -641,7 +641,7 @@

widget.focus();

widget.on( 'edit', function( evt ) {
widget.once( 'edit', function( evt ) {
editFired += 1;
evt.cancel();
} );
@@ -650,6 +650,46 @@

assert.areSame( 1, editFired, 'Widget.edit was called' );
} );
},

'test cancelling cancel widget dialog does not destroy widget (#13158).': function() {
var editor = this.editor,
originalConfirm = window.confirm;

// Setup.
window.confirm = function() {
return false;
};

this.editorBot.setData( '<p>foo</p>', function() {
editor.once( 'dialogShow', function( evt ) {
var spy = sinon.stub( editor.widgets, 'destroy' ),
dialog = evt.data;

dialog.once( 'cancel', function() {
resume( function() {
assert.isFalse( spy.called );

// Teardown.
window.confirm = function() {
return true;
};
dialog.getButton( 'cancel' ).click();
window.confirm = originalConfirm;
} );
} );

// We have to wait here because of this:
// https://github.com/cksource/ckeditor-dev/blob/4fbe94b5fb4be9b1d440462cbc8f0c75e00350a5/plugins/dialog/plugin.js#L910
setTimeout( function() {
dialog.getContentElement( 'info', 'value1' ).setValue( 'bar' );
dialog.getButton( 'cancel' ).click();
}, 200 );
} );

editor.execCommand( 'test1' );
wait();
} );
}
} );
} )();
} )();
@@ -0,0 +1,7 @@
<div id="editor" contenteditable="true" >
<p>Some proper link: http://i.imgur.com/Z3ilPBI.jpg</p>
</div>

<script>
CKEDITOR.replace( 'editor' );
</script>
@@ -0,0 +1,12 @@
@bender-tags: 4.5.0, tc, widget, widgetcore
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, toolbar, embed

1. Copy some proper link into clipboard.
2. Click "embed" button to open dialog.
3. Paste link into text input.
4. Click "cancel" (system popup will be shown).
5. Click "cancel" in the system popup.
6. Click "ok" in the embed popup.

**Expected:** Embed media should be added.

0 comments on commit 24d1c51

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