@@ -148,13 +148,13 @@ describe('Directive', function () {
148
148
149
149
describe ( 'instantiation' , function ( ) {
150
150
151
- it ( 'should copy the definition as _update if the def is a function' , function ( ) {
151
+ it ( 'should copy the definition as update if the def is a function' , function ( ) {
152
152
153
153
var testDir = function ( ) { }
154
154
directives . test = testDir
155
155
156
156
var d = build ( 'test' , 'abc' , compiler )
157
- assert . strictEqual ( d . _update , testDir )
157
+ assert . strictEqual ( d . update , testDir )
158
158
} )
159
159
160
160
it ( 'should copy methods if the def is an object' , function ( ) {
@@ -168,8 +168,8 @@ describe('Directive', function () {
168
168
directives . obj = obj
169
169
170
170
var d = build ( 'obj' , 'abc' , compiler )
171
- assert . strictEqual ( d . _update , obj . update , 'update should be copied as _update' )
172
- assert . strictEqual ( d . _unbind , obj . unbind , 'unbind should be copied as _unbind' )
171
+ assert . strictEqual ( d . update , obj . update )
172
+ assert . strictEqual ( d . unbind , obj . unbind )
173
173
assert . strictEqual ( d . bind , obj . bind )
174
174
assert . strictEqual ( d . custom , obj . custom , 'should copy any custom methods' )
175
175
} )
@@ -261,80 +261,80 @@ describe('Directive', function () {
261
261
262
262
} )
263
263
264
- describe ( '.applyFilters()' , function ( ) {
264
+ describe ( '.$ applyFilters()' , function ( ) {
265
265
266
266
it ( 'should work' , function ( ) {
267
267
var d = build ( 'text' , 'abc | pluralize item | capitalize' , compiler ) ,
268
- v = d . applyFilters ( 2 )
268
+ v = d . $ applyFilters( 2 )
269
269
assert . strictEqual ( v , 'Items' )
270
270
} )
271
271
272
272
} )
273
273
274
- describe ( '.update()' , function ( ) {
274
+ describe ( '.$ update()' , function ( ) {
275
275
276
276
var d = build ( 'text' , 'abc' , compiler ) ,
277
277
updated = false
278
- d . _update = function ( ) {
278
+ d . update = function ( ) {
279
279
updated = true
280
280
}
281
281
282
- it ( 'should call _update () for first time update, even with undefined' , function ( ) {
283
- d . update ( undefined , true )
282
+ it ( 'should call user update () for first time update, even with undefined' , function ( ) {
283
+ d . $ update( undefined , true )
284
284
assert . strictEqual ( updated , true )
285
285
} )
286
286
287
- it ( 'should _update () when a different value is given' , function ( ) {
287
+ it ( 'should user update () when a different value is given' , function ( ) {
288
288
updated = false
289
- d . update ( 123 )
289
+ d . $ update( 123 )
290
290
assert . strictEqual ( d . value , 123 )
291
291
assert . strictEqual ( updated , true )
292
292
} )
293
293
294
- it ( 'should not _update () if the value is the same' , function ( ) {
294
+ it ( 'should not call user update () if the value is the same' , function ( ) {
295
295
updated = false
296
- d . update ( 123 )
296
+ d . $ update( 123 )
297
297
assert . ok ( ! updated )
298
298
} )
299
299
300
- it ( 'should call applyFilter() is there are filters' , function ( ) {
300
+ it ( 'should call $ applyFilter() is there are filters' , function ( ) {
301
301
var filterApplied = false
302
302
d . filters = [ ]
303
- d . applyFilters = function ( ) {
303
+ d . $ applyFilters = function ( ) {
304
304
filterApplied = true
305
305
}
306
- d . update ( 234 )
306
+ d . $ update( 234 )
307
307
assert . ok ( filterApplied )
308
308
} )
309
309
310
310
} )
311
311
312
- describe ( '.unbind()' , function ( ) {
312
+ describe ( '.$ unbind()' , function ( ) {
313
313
314
314
var d = build ( 'text' , 'abc' , compiler ) ,
315
315
unbound = false ,
316
316
val
317
- d . _unbind = function ( v ) {
317
+ d . unbind = function ( v ) {
318
318
val = v
319
319
unbound = true
320
320
}
321
321
322
322
it ( 'should not work if it has no element yet' , function ( ) {
323
323
d . el = null
324
- d . unbind ( )
324
+ d . $ unbind( )
325
325
assert . strictEqual ( unbound , false )
326
326
} )
327
327
328
- it ( 'should call _unbind () and null everything if it has an element' , function ( ) {
328
+ it ( 'should call user unbind () and null everything if it has an element' , function ( ) {
329
329
d . el = true
330
- d . unbind ( )
330
+ d . $ unbind( )
331
331
assert . strictEqual ( unbound , true )
332
332
assert . ok ( d . el === null && d . vm === null && d . binding === null && d . compiler === null )
333
333
} )
334
334
335
335
it ( 'should not execute if called more than once' , function ( ) {
336
336
unbound = false
337
- d . unbind ( )
337
+ d . $ unbind( )
338
338
assert . notOk ( unbound )
339
339
} )
340
340
0 commit comments