Ticket #4242: 4242_2.patch

File 4242_2.patch, 2.3 KB (added by Garry Yao, 15 years ago)
  • _test/cktester/runners/yuitest/extension.js

     
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
    55
    6 (function()
     6// Extending YUI TestCase functionality.
     7( function()
    78{
     9        var native = YAHOO.tool.TestCase;
     10        YAHOO.tool.TestCase = function( template )
     11        {
     12                // Ignore all tests from the template other than the one specified by 'ignoreAllBut'.
     13                try
     14                {
     15                        var only = template._should.ignoreAllBut;
     16                        if( only )
     17                        {
     18                                delete template._should.ignoreAllBut;
     19                                var ignores = template._should.ignore = {}, match, test;
     20                                for ( test in template )
     21                                {
     22                                        if ( ( match = test.match( /^test(.*)/ ) ) && match[ 0 ] != only )
     23                                                ignores[ match[ 0 ] ] = true;
     24                                }
     25                        }
     26
     27                }catch( er ){}
     28
     29                return native.call( this, template );
     30        };
     31        YAHOO.tool.TestCase.prototype = native.prototype;
     32        YAHOO.tool.TestCase.Wait = native.Wait;
     33} )();
     34
     35(function()
     36{
    837        var createLogger = function()
    938        {
    1039                document.body.appendChild( document.createElement( 'div' ) ).id = 'testLogger';
     
    1746                div.innerHTML = text;
    1847        };
    1948
     49        var runner = YAHOO.tool.TestRunner;
     50        // Report runner status to cell.
     51        if ( CKTester.cell )
     52        {
     53                runner.subscribe( runner.TEST_CASE_BEGIN_EVENT, CKTester.cell.start );
     54                runner.subscribe( runner.TEST_CASE_COMPLETE_EVENT, CKTester.cell.complete );
     55        }
     56
    2057        var htmlEncode = function( data )
    2158        {
    2259                if ( typeof data != 'string' )
     
    3168        window.onload = function()
    3269        {
    3370                createLogger();
    34                 var runner = YAHOO.tool.TestRunner;
    3571
    3672                var handleTestResult = function( data )
    3773                {
     
    66102                runner.subscribe(runner.TEST_IGNORE_EVENT, handleTestResult);
    67103                runner.subscribe(runner.TEST_PASS_EVENT, handleTestResult);
    68104
    69                 if ( CKTester.cell )
    70                 {
    71                         runner.subscribe( runner.TEST_CASE_BEGIN_EVENT, CKTester.cell.start );
    72                         runner.subscribe( runner.TEST_CASE_COMPLETE_EVENT, CKTester.cell.complete );
    73                 }
    74 
    75105                // Whether control the runner manually instead of running on window onload.
    76106                !runner.defer && runner.run();
    77107        };
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy