@@ -188,10 +188,11 @@ describe('cocktail', function(){
188
188
describe ( 'Use' , function ( ) {
189
189
190
190
describe ( 'use(Class)' , function ( ) {
191
- var MyAnnotation = function ( ) { } ,
192
- processors ;
193
191
194
192
it ( 'adds MyAnnotation Class as a custom processor' , function ( ) {
193
+ var MyAnnotation = function ( ) { } ,
194
+ processors ;
195
+
195
196
MyAnnotation . prototype . name = '@myannotation' ;
196
197
197
198
cocktail . use ( MyAnnotation ) ;
@@ -204,6 +205,38 @@ describe('cocktail', function(){
204
205
205
206
} ) ;
206
207
208
+ it ( 'does not add MyAnnotation Class as a custom processor if name doesn\'t start wiht @' , function ( ) {
209
+ var MyAnnotation = function ( ) { } ,
210
+ processors ;
211
+
212
+ MyAnnotation . prototype . name = 'myannotation' ;
213
+
214
+ cocktail . use ( MyAnnotation ) ;
215
+
216
+ processors = cocktail . getProcessors ( ) ;
217
+
218
+ expect ( processors ) . to . not . have . property ( '@myannotation' ) ;
219
+
220
+ expect ( processors [ '@myannotation' ] ) . to . be . equal ( undefined ) ;
221
+
222
+ } ) ;
223
+
224
+ it ( 'does not add MyAnnotation Class as a custom processor if name is not defined in prototype' , function ( ) {
225
+ var MyAnnotation = function myannotation ( ) { } ,
226
+ processors ;
227
+
228
+ expect ( MyAnnotation . name ) . to . be . equal ( 'myannotation' ) ;
229
+
230
+ cocktail . use ( MyAnnotation ) ;
231
+
232
+ processors = cocktail . getProcessors ( ) ;
233
+
234
+ expect ( processors ) . to . not . have . property ( '@myannotation' ) ;
235
+
236
+ expect ( processors [ '@myannotation' ] ) . to . be . equal ( undefined ) ;
237
+
238
+ } ) ;
239
+
207
240
} ) ;
208
241
209
242
0 commit comments