Ticket #2927: test-events-duplicate.patch

File test-events-duplicate.patch, 1.3 KB (added by Garry Yao, 15 years ago)

Functional testcase

  • _source/tests/core/event.html

     
    6161                        assert.areSame( 'a,b', calls.toString() );
    6262                },
    6363
    64                 test_implementOn : function()
     64                test_implementOn1 : function()
    6565                {
    6666                        // Create a testObject and implement CKEDITOR.event on it.
    6767                        var testObject = { someprop : 'Test' };
     
    102102                        assert.areSame( 2, calls.length, 'number of calls doesn\'t match' );
    103103                        assert.areSame( 'a,b', calls.toString() );
    104104                },
    105 
     105               
     106                /**
     107                 * Test the {@link CKEDITOR.event.implementOn} correctly applied on prototype object.
     108                 */
     109                test_implementOn2 : function()
     110                {
     111                        var times = 0;
     112       
     113                        function myClass()
     114                        {
     115                                CKEDITOR.event.call( this );
     116                        }
     117                        CKEDITOR.event.implementOn( myClass.prototype );
     118       
     119                        var instance1 = new myClass(), instance2 = new myClass();
     120       
     121                        instance1.on( 'event1', function()
     122                        {
     123                                times++;
     124                        } );
     125                        instance2.on( 'event1', function()
     126                        {
     127                                times++;
     128                        } );
     129                        //sync
     130                        instance1.fire( 'event1' );
     131                        assert.areSame( 1, times );
     132       
     133                },     
     134               
    106135                test_eventNameCase : function()
    107136                {
    108137                        // Create a testObject and implement CKEDITOR.event on it.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy