Skip to content
Permalink
Browse files

Merge branch 't/7634b'

  • Loading branch information...
oleq committed Jun 16, 2014
2 parents 7ffe649 + 75c0937 commit e8e46f36ccf6ec9da29519ae799adaa319497c7d
Showing with 127 additions and 1 deletion.
  1. +1 −0 CHANGES.md
  2. +5 −1 plugins/flash/dialogs/flash.js
  3. +121 −0 tests/plugins/flash/fullScreen.js
@@ -29,6 +29,7 @@ Fixed Issues:
* [#7975](http://dev.ckeditor.com/ticket/7975): [IE8] Fixed: Errors when trying to select empty table cell on IE8.
* [#11947](http://dev.ckeditor.com/ticket/11947): [FF+IE11] Fixed: Shift+Enter in lists produces two line breaks.
* [#11972](http://dev.ckeditor.com/ticket/11972): Fixed: Feature detection in the [`element.setText()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-setText) method should not trigger layout engine.
* [#7634](http://dev.ckeditor.com/ticket/7634): Fixed: Flash plugin omits `allowFullScreen` parameter in editor data if set `true`.

## CKEditor 4.4.1

@@ -87,7 +87,11 @@
}, {
type: ATTRTYPE_PARAM, name: names[ i ]
} ];
names = [ 'allowFullScreen', 'play', 'loop', 'menu' ];

// These attributes are "true" by default and not present in editor data (when "true").
// Note that, though default value of "allowFullScreen" is "true", it is not listed here.
// "allowFullScreen" is present in editor data regardless of the value (#7634).
names = [ 'play', 'loop', 'menu' ];
for ( i = 0; i < names.length; i++ )
attributesMap[ names[ i ] ][ 0 ][ 'default' ] = attributesMap[ names[ i ] ][ 1 ][ 'default' ] = true;

@@ -0,0 +1,121 @@
/* bender-tags: editor,unit */
/* bender-ckeditor-plugins: flash,toolbar */

( function() {
'use strict';

var editorBots,
FLASH_URL = '%BASE_PATH%_assets/sample.swf';

bender.test( {
'async:init': function() {
var that = this;

bender.tools.setUpEditors( {
one: {
name: 'one'
}
}, function( editors, bots ) {
editorBots = bots;
that.callback( editors );
} );
},

tearDown: function() {
var currentDialog = CKEDITOR.dialog.getCurrent();

if ( currentDialog )
currentDialog.hide();
},

// true is default value for allowFullScreen property
'test param allowFullScreen present in code with true value': function() {
var bot = editorBots.one;

bot.setData( '', function() {
bot.dialog( 'flash', function( dialog ) {
dialog.setValueOf( 'info', 'src', FLASH_URL );

var allowFullScreenBtn = dialog.getContentElement( 'properties', 'allowFullScreen' );
assert.areEqual( true, allowFullScreenBtn.getValue(), 'Default value should be set to true' );

dialog.getButton( 'ok' ).click();

var fullScreenParam = getFullScreenParam( bot );
assert.areEqual( 'true', fullScreenParam.attributes.value, 'Value should be set to true.' );

var embed = getEmbed( bot );
assert.areSame( 'true', embed.attributes.allowfullscreen, 'allowfullscreen set for embed' );

selectFirstFlashElementInEditor( bot );

bot.dialog( 'flash', function( dialog ) {
allowFullScreenBtn = dialog.getContentElement( 'properties', 'allowFullScreen' );

assert.areEqual( true, allowFullScreenBtn.getValue(), 'Default value should be still set to true' );
} );
} );
} );
},

'test param allowFullScreen present in code with false value': function() {
var bot = editorBots.one;

bot.setData( '', function() {
bot.dialog( 'flash', function( dialog ) {
dialog.setValueOf( 'info', 'src', FLASH_URL );

var allowFullScreenBtn = dialog.getContentElement( 'properties', 'allowFullScreen' );
allowFullScreenBtn.setValue( false );

dialog.getButton( 'ok' ).click();

var fullScreenParam = getFullScreenParam( bot );
assert.areEqual( 'false', fullScreenParam.attributes.value, 'Value should be set to false.' );

var embed = getEmbed( bot );
assert.areSame( 'false', embed.attributes.allowfullscreen, 'allowfullscreen set for embed' );

selectFirstFlashElementInEditor( bot );

bot.dialog( 'flash', function( dialog ) {
allowFullScreenBtn = dialog.getContentElement( 'properties', 'allowFullScreen' );

assert.areEqual( false, allowFullScreenBtn.getValue(), 'Default value should be still set to false' );
} );
} );
} );
}
} );

function selectFirstFlashElementInEditor( bot ) {
var flashElement = bot.editor.document.findOne( 'img' );

bot.editor.getSelection().selectElement( flashElement );
}

function getObjectChildElement( bot, lookupFn ) {
var fragment = CKEDITOR.htmlParser.fragment.fromHtml( bot.getData() ),
found = null;

fragment.forEach( function( element ) {
if ( lookupFn( element ) ) {
found = element;
}
} );

return found;
}

function getFullScreenParam( bot ) {
return getObjectChildElement( bot, function( element ) {
return element.name == 'param' && element.attributes.name == 'allowFullScreen';
} );
}

function getEmbed( bot ) {
return getObjectChildElement( bot, function( element ) {
return element.name == 'embed';
} );
}
} )();

0 comments on commit e8e46f3

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