Skip to content
Permalink
Browse files

Merge branch 't/12935' into major

  • Loading branch information...
Reinmar committed Feb 24, 2015
2 parents dc3ecf4 + 5c7fed3 commit 339d41987f0d43b31a2c26e221f82941ca84452b
Showing with 62 additions and 51 deletions.
  1. +2 −2 package.json
  2. +60 −49 tests/_benderjs/ckeditor/static/extensions.js
@@ -3,10 +3,10 @@
"version": "4.5.0",
"description": "The development version of CKEditor - JavaScript WYSIWYG web text editor.",
"devDependencies": {
"benderjs": "~0.2.1",
"benderjs": "~0.2.2",
"benderjs-jquery": "~0.3.0",
"benderjs-sinon": "~0.2.1",
"benderjs-yui": "~0.2.3",
"benderjs-yui": "~0.2.4",
"grunt": "~0",
"grunt-contrib-imagemin": "^0.8.1",
"grunt-jscs": "~1",
@@ -10,13 +10,13 @@
YTest = bender.Y.Test,
i;

// override and extend assertions
// Override and extend assertions.
window.assert = bender.assert;
window.arrayAssert = bender.arrayAssert;
window.objectAssert = bender.objectAssert;

// clean-up data from previous tests if available
// TODO check if this could be deleted after separating test context from parent
// Clean-up data from previous tests if available.
// TODO check if this could be deleted after separating test context from parent.
if ( bender.editor ) {
delete bender.editor;
}
@@ -109,7 +109,8 @@
};

/**
* Asserts that HTML data are the same. Use {@link bender.tools.compatHtml} to sort attributes, fix styles and encode Nbsp.
* Asserts that HTML data are the same. Use {@link bender.tools.compatHtml} to sort attributes,
* fix styles and encode `nbsp`.
*
* @param {String} expected
* @param {String} actual
@@ -119,7 +120,7 @@
assert.areSame( expected, bender.tools.compatHtml( actual, false, true, false, true, true ), message );
};

// add support test ignore
// Add support test ignore.
YUITest.Ignore = function() {};

bender.assert.ignore = function() {
@@ -153,7 +154,7 @@

if ( typeof test == 'string' ) {
updateResult( node.parent, test );
// Ignore all tests in this whole test case
// Ignore all tests in this whole test case.
} else {
for ( name in test ) {
if ( typeof test[ name ] == 'function' && name.match( /^test/ ) ) {
@@ -165,47 +166,47 @@
};

YTest.Runner._resumeTest = function( segment ) {
//get relevant information
// Get relevant information.
var node = this._cur,
failed = false,
ignored = false,
error = null,
testName, testCase, shouldFail, shouldError;

//we know there's no more waiting now
// We know there's no more waiting now.
this._waiting = false;

//if there's no node, it probably means a wait() was called after resume()
// If there's no node, it probably means a wait() was called after resume().
if ( !node ) {
return;
}

testName = node.testObject;
testCase = node.parent.testObject;

//cancel other waits if available
// Cancel other waits if available.
if ( testCase.__yui_wait ) {
clearTimeout( testCase.__yui_wait );
delete testCase.__yui_wait;
}

//get the "should" test cases
// Get the "should" test cases.
shouldFail = testName.indexOf( 'fail:' ) === 0 ||
( testCase._should.fail || {} )[ testName ];

shouldError = ( testCase._should.error || {} )[ testName ];

this._inTest = true;

//try the test
// Try the test.
try {
//run the test
// Run the test.
segment.call( testCase, this._context );

//if the test hasn't already failed and doesn't have any asserts...
// If the test hasn't already failed and doesn't have any asserts...
if ( !YUITest.Assert._getCount() && !this._ignoreEmpty ) {
throw new YUITest.AssertionError( 'Test has no asserts.' );
//if it should fail, and it got here, then it's a fail because it didn't
// If it should fail, and it got here, then it's a fail because it didn't.
} else if ( shouldFail ) {
error = new YUITest.ShouldFail();
failed = true;
@@ -214,7 +215,7 @@
failed = true;
}
} catch ( thrown ) {
//cancel any pending waits, the test already failed
// Cancel any pending waits, the test already failed.
if ( testCase.__yui_wait ) {
clearTimeout( testCase.__yui_wait );
delete testCase.__yui_wait;
@@ -231,7 +232,7 @@
} else if ( thrown instanceof YUITest.Wait ) {
if ( typeof thrown.segment == 'function' ) {
if ( typeof thrown.delay == 'number' ) {
//some environments don't support setTimeout
// Some environments don't support setTimeout.
if ( typeof setTimeout != 'undefined' ) {
testCase.__yui_wait = setTimeout( function() {
YUITest.TestRunner._resumeTest( thrown.segment );
@@ -246,7 +247,7 @@

return;
} else {
//first check to see if it should error
// First check to see if it should error.
if ( !shouldError ) {
error = new YUITest.UnexpectedError( thrown );
failed = true;
@@ -270,21 +271,21 @@
this._inTest = false;

if ( !ignored ) {
//fire appropriate event
// Fire appropriate event.
this.fire( {
type: failed ? this.TEST_FAIL_EVENT : this.TEST_PASS_EVENT,
testCase: testCase,
testName: testName,
error: failed ? error : undefined
} );

//run the tear down
// Run the tear down.
this._execNonTestMethod( node.parent, 'tearDown', false );

//reset the assert count
// Reset the assert count.
YUITest.Assert._reset();

//update results
// Update results.
node.parent.results[ testName ] = {
result: failed ? 'fail' : 'pass',
message: error ? error.getMessage() : 'Test passed',
@@ -302,7 +303,7 @@
node.parent.results.total++;
}

//set timeout not supported in all environments
// Set timeout not supported in all environments.
if ( typeof setTimeout != 'undefined' ) {
setTimeout( function() {
YUITest.TestRunner._run();
@@ -397,7 +398,7 @@

if ( bender.plugins ) {
toLoad++;
bender.deferred = true;
defer();

CKEDITOR.plugins.load( config.plugins, onLoad );
}
@@ -408,7 +409,7 @@
}

toLoad++;
bender.deferred = true;
defer();

CKEDITOR.scriptLoader.load( config.adapters, onLoad );
}
@@ -419,36 +420,40 @@
}

if ( !toLoad ) {
if ( bender.deferred ) {
delete bender.deferred;
}

bender.startRunner();
startRunner();
}
}
};

// keep reference to adapter's test function
bender.orgTest = bender.test;
var unlock, deferredTests;

bender.test = function( tests ) {
if ( bender.deferred ) {
delete bender.deferred;
// Defers Bender's startup.
function defer() {
if ( !unlock ) {
unlock = bender.defer();
}
}

// Keep a reference to the original bender.test function.
var orgTest = bender.test;

// Flag saying if we need to restart the tests, e.g. when bender.test was executed asynchronously.
var restart = false;

bender.deferredTests = tests;
bender.test = function( tests ) {
if ( unlock && !restart ) {
deferredTests = tests;
} else {
bender.startRunner( tests );
startRunner( tests );
}
};

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

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

// startRunner was executed but there were no tests available yet.
if ( !tests ) {
restart = true;
return;
}

@@ -477,9 +482,15 @@
}
}

bender.orgTest( tests );
// Run the original bender.test function.
orgTest( tests );

// async:init stage 1: set up bender.editor
// Unlock Bender startup.
if ( unlock ) {
unlock();
}

// async:init stage 1: set up bender.editor.
function setUpEditor() {
if ( !bender.editor ) {
// If there is no bender.editor jump to stage 2.
@@ -494,7 +505,7 @@
} );
}

// async:init stage 2: set up bender.editors
// async:init stage 2: set up bender.editors.
function setUpEditors() {
if ( !bender.editors ) {
// If there is no bender.editor jump to stage 3.
@@ -544,7 +555,7 @@
}
}

// async:init stage 3: call original async/async:init and finish async:init (testCase.callback).
// async:init stage 3: call original async/async:init and finish async:init (testCase.callback).
function callback() {
if ( bender._init ) {
var init = bender._init;
@@ -565,7 +576,7 @@
}
}
}
};
}

function onDocumentReady( callback ) {
function complete() {
@@ -620,7 +631,7 @@
};
} )( this, bender );

// workaround for IE8 - window.resume / window.wait won't work in this environment...
// Workaround for IE8 - window.resume / window.wait won't work in this environment...
var resume = bender.Y.Test.Case.prototype.resume = ( function() { // jshint ignore:line
var org = bender.Y.Test.Case.prototype.resume;

0 comments on commit 339d419

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