Skip to content
Permalink
Browse files

Merge branch 't/12781' into major

  • Loading branch information...
Reinmar committed Jan 12, 2015
2 parents 023809d + a195c8f commit af2b59d0d5acafccb09000482650afb888d9f5b5
Showing with 1,681 additions and 1,838 deletions.
  1. +125 −50 tests/_benderjs/ckeditor/static/extensions.js
  2. +9 −39 tests/_benderjs/ckeditor/static/tools.js
  3. +6 −14 tests/core/editable/domfixnestededitable.js
  4. +10 −18 tests/core/editable/misc.js
  5. +46 −68 tests/core/editable/readonly.js
  6. +3 −5 tests/core/editable/status.js
  7. +8 −29 tests/core/editor/readonly.js
  8. +125 −146 tests/core/editor/title.js
  9. +34 −42 tests/core/filter/blacklisting.js
  10. +6 −14 tests/core/filter/elementcallback.js
  11. +88 −115 tests/core/filter/filter.js
  12. +52 −68 tests/core/htmldataprocessor.js
  13. +43 −54 tests/core/selection/editor.js
  14. +6 −14 tests/core/style/customstylehandler.js
  15. +16 −24 tests/plugins/a11yhelp/editorhelp.js
  16. +16 −25 tests/plugins/clipboard/datatransfer.js
  17. +79 −81 tests/plugins/clipboard/drop.js
  18. +20 −28 tests/plugins/codesnippet/undo.js
  19. +17 −26 tests/plugins/enter/enterkey.js
  20. +30 −48 tests/plugins/enter/list.js
  21. +6 −14 tests/plugins/fakeobjects/fakeobjects.js
  22. +9 −17 tests/plugins/flash/fullScreen.js
  23. +12 −20 tests/plugins/image2/acf.js
  24. +54 −68 tests/plugins/image2/internal.js
  25. +41 −49 tests/plugins/image2/styles.js
  26. +18 −25 tests/plugins/image2/upcast.js
  27. +121 −148 tests/plugins/indent/indent.js
  28. +39 −49 tests/plugins/link/dialog.js
  29. +14 −22 tests/plugins/link/validator.js
  30. +32 −36 tests/plugins/mathjax/mathjax-mock.js
  31. +167 −169 tests/plugins/pastefromword/movetotext.js
  32. +13 −22 tests/plugins/placeholder/upcasting.js
  33. +11 −20 tests/plugins/selectall/selectall.js
  34. +9 −17 tests/plugins/table/table.js
  35. +71 −73 tests/plugins/tableresize/tableresize.js
  36. +3 −5 tests/plugins/undo/setdatasetmode.js
  37. +13 −22 tests/plugins/widget/checkdirty.js
  38. +18 −26 tests/plugins/widget/customstylehandler.js
  39. +26 −32 tests/plugins/widget/nestedwidgets.js
  40. +21 −29 tests/plugins/wysiwygarea/fullpage.js
  41. +7 −16 tests/tickets/11384/1.js
  42. +29 −32 tests/tickets/11500/1.js
  43. +10 −19 tests/tickets/11641/1.js
  44. +15 −0 tests/utils/initeditor/editor.js
  45. +20 −0 tests/utils/initeditor/editorasyncinit.js
  46. +19 −0 tests/utils/initeditor/editorinit.js
  47. +24 −0 tests/utils/initeditor/editors.js
  48. +29 −0 tests/utils/initeditor/editorsasyncinit.js
  49. +42 −0 tests/utils/initeditor/editorsconfig.js
  50. +28 −0 tests/utils/initeditor/editorsinit.js
  51. +21 −0 tests/utils/initeditor/editorsnonames.js
@@ -417,49 +417,18 @@
};

// keep reference to adapter's test function
bender.oldTest = bender.test;
bender.orgTest = bender.test;

bender.test = function( tests ) {
if ( bender.deferred ) {
if ( bender.deferred ) {
delete bender.deferred;
}
delete bender.deferred;

bender.deferredTests = tests;
} else {
bender.startRunner( tests );
}
};

function onReady( callback ) {
function complete() {
if ( document.addEventListener ||
event.type === 'load' ||
document.readyState === 'complete' ) {

if ( document.removeEventListener ) {
document.removeEventListener( 'DOMContentLoaded', complete, false );
window.removeEventListener( 'load', complete, false );
} else {
document.detachEvent( 'onreadystatechange', complete );
window.detachEvent( 'onload', complete );
}

callback();
}
}

if ( document.readyState === 'complete' ) {
setTimeout( callback );
} else if ( document.addEventListener ) {
document.addEventListener( 'DOMContentLoaded', complete, false );
window.addEventListener( 'load', complete, false );
} else {
document.attachEvent( 'onreadystatechange', complete );
window.attachEvent( 'onload', complete );
}
}

bender.startRunner = function( tests ) {
tests = tests || bender.deferredTests;

@@ -475,21 +444,14 @@
tests.name = bender.testData.id;
}

function startRunner() {
// catch exceptions
if ( bender.editor ) {
if ( tests[ 'async:init' ] || tests.init ) {
throw 'The "init/async:init" is not supported in conjunction' +
' with bender.editor, use "setUp" instead.';
}
onDocumentReady( start );

tests[ 'async:init' ] = function() {
bender.editorBot.create( bender.editor, function( bot ) {
bender.editor = bender.testCase.editor = bot.editor;
bender.testCase.editorBot = bot;
bender.testCase.callback();
} );
};
function start() {
if ( bender.editor || bender.editors ) {
bender._init = tests.init;
bender._asyncInit = tests[ 'async:init' ];

tests[ 'async:init' ] = setUpEditor;

if ( bender.runner._running ) {
wait();
@@ -503,12 +465,125 @@
}
}

bender.oldTest( tests );
}
bender.orgTest( tests );

// async:init stage 1: set up bender.editor
function setUpEditor() {
if ( !bender.editor ) {
// If there is no bender.editor jump to stage 2.
setUpEditors();
return;
}

bender.editorBot.create( bender.editor, function( bot ) {
bender.editor = bender.testCase.editor = bot.editor;
bender.testCase.editorBot = bot;
setUpEditors();
} );
}

// async:init stage 2: set up bender.editors
function setUpEditors() {
if ( !bender.editors ) {
// If there is no bender.editor jump to stage 3.
callback();
return;
}

var editorsDefinitions = bender.editors,
names = [],
editors = {},
bots = {},
i = 0;

// The funniest for-in loop I've ever seen.
for ( names[ i++ ] in editorsDefinitions ); // jshint ignore:line

next();

function next() {
var name = names.shift(),
definition = editorsDefinitions[ name ];

if ( !name ) {
bender.editors = bender.testCase.editors = editors;
bender.editorBots = bender.testCase.editorBots = bots;
callback();
return;
}

if ( !definition.name ) {
definition.name = name;
}

onReady( startRunner );
if ( bender.editorsConfig ) {
if ( !definition.config ) {
definition.config = {};
}

CKEDITOR.tools.extend( definition.config, bender.editorsConfig );
}

bender.editorBot.create( definition, function( bot ) {
bots[ name ] = bot;
editors[ name ] = bot.editor;
next();
} );
}
}

// async:init stage 3: call original async/async:init and finish async:init (testCase.callback).
function callback() {
if ( bender._init ) {
var init = bender._init;

delete bender._init;

init.call( bender.testCase );
}

if ( bender._asyncInit ) {
var asyncInit = bender._asyncInit;

delete bender._asyncInit;

asyncInit.call( bender.testCase );
} else {
bender.testCase.callback();
}
}
}
};

function onDocumentReady( callback ) {
function complete() {
if ( document.addEventListener ||
event.type === 'load' ||
document.readyState === 'complete' ) {

if ( document.removeEventListener ) {
document.removeEventListener( 'DOMContentLoaded', complete, false );
window.removeEventListener( 'load', complete, false );
} else {
document.detachEvent( 'onreadystatechange', complete );
window.detachEvent( 'onload', complete );
}

callback();
}
}

if ( document.readyState === 'complete' ) {
setTimeout( callback );
} else if ( document.addEventListener ) {
document.addEventListener( 'DOMContentLoaded', complete, false );
window.addEventListener( 'load', complete, false );
} else {
document.attachEvent( 'onreadystatechange', complete );
window.attachEvent( 'onload', complete );
}
}

bender.getAbsolutePath = function( path ) {
var suffixIndex, suffix, temp;

@@ -912,69 +912,39 @@
return str.replace( /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&' );
},

/**
* Creates editors defined in `editorsDefinitions` and passes them along with editorBots to the callback.
*
* @param {Object} editors Definitions map of the editors definitions in the same format as `editorBot` use.
* @param {Function} callback Function called when all of the editors will be created.
*/
setUpEditors: function( editorsDefinitions, callback ) {
var names = [],
editors = {},
bots = {};

for ( var e in editorsDefinitions ) {
names.push( e );
}

next();

function next() {
var name = names.shift();

if ( !name ) {
callback( editors, bots );
return;
}

bender.editorBot.create( editorsDefinitions[ name ], function( bot ) {
bots[ name ] = bot;
editors[ name ] = bot.editor;
next();
} );
}
},

/**
* Multiplies inputTests for every editor.
*
* @param {Object} editors
* @param {Object} editorsDefinitions editors definitions.
* @param {Object} inputTests Tests to apply on every editor.
* @returns {Object} Created tests for every editor.
*/
createTestsForEditors: function( editors, inputTests ) {
createTestsForEditors: function( editorsNames, inputTests ) {
var outputTests = {},
specificTestName,
specialMethods = {
'init': 1,
'async:init': 1,
'setUp': 1,
'tearDown': 1
};
},
i, editorName;

for ( var method in specialMethods ) {
if ( inputTests[ method ] ) {
outputTests[ method ] = inputTests[ method ];
}
}

for ( var editorName in editors ) {
for ( i = 0; i < editorsNames.length; i++ ) {
editorName = editorsNames[ i ];

for ( var testName in inputTests ) {
if ( specialMethods[ testName ] ) {
continue;
}

specificTestName = testName + ' (' + editors[ editorName ].name + ')';
specificTestName = testName + ' (' + editorName + ')';

// Avoid silent failure.
if ( outputTests[ specificTestName ] ) {
@@ -983,7 +953,7 @@

outputTests[ specificTestName ] = ( function( testName, editorName ) {
return function() {
inputTests[ testName ]( editors[ editorName ] );
inputTests[ testName ]( bender.editors[ editorName ] );
};
} )( testName, editorName );
}
@@ -3,21 +3,13 @@
( function() {
'use strict';

bender.test( {
// Initialize the editor instance.
'async:init': function() {
var that = this;

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

bender.test( {
// (#12162)
'test autoparagraphing in nested editable': function() {
var editor = this.editors.editor1,
@@ -2,25 +2,17 @@

'use strict';

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

bender.tools.setUpEditors( {
editor: {
name: 'editor1',
creator: 'inline',
config: {
allowedContent: true
}
}
}, function( editors, bots ) {
that.editorBots = bots;
that.editors = editors;
that.callback();
} );
},
bender.editors = {
editor: {
name: 'editor1',
creator: 'inline',
config: {
allowedContent: true
}
}
};

bender.test( {
// #3448.
'test click on image selects it': function() {
// This is Gecko/Webkit/Blink fix.
Oops, something went wrong.

0 comments on commit af2b59d

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