| 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, true ); |
| 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 | }, |
| 135 | /** |
| 136 | * Test the {@link CKEDITOR.event.implementOn} correctly applied on prototype object without constructor. |
| 137 | */ |
| 138 | test_implementOn3 : function() |
| 139 | { |
| 140 | var times = 0; |
| 141 | |
| 142 | function myClass(){} |
| 143 | CKEDITOR.event.implementOn( myClass.prototype, true ); |
| 144 | |
| 145 | var instance1 = new myClass(), instance2 = new myClass(); |
| 146 | |
| 147 | instance1.on( 'event1', function() |
| 148 | { |
| 149 | times++; |
| 150 | } ); |
| 151 | instance2.on( 'event1', function() |
| 152 | { |
| 153 | times++; |
| 154 | } ); |
| 155 | //sync |
| 156 | instance1.fire( 'event1' ); |
| 157 | assert.areSame( 1, times ); |
| 158 | |
| 159 | }, |
| 160 | |