@@ -5148,6 +5148,9 @@ describe('$compile', function() {
5148
5148
owOptref : '<?' ,
5149
5149
owOptrefAlias : '<? owOptref' ,
5150
5150
$owOptrefAlias : '<? $owOptref$' ,
5151
+ owColref : '<*' ,
5152
+ owColrefAlias : '<* owColref' ,
5153
+ $owColrefAlias : '<* $owColref$' ,
5151
5154
expr : '&' ,
5152
5155
optExpr : '&?' ,
5153
5156
exprAlias : '&expr' ,
@@ -6327,6 +6330,61 @@ describe('$compile', function() {
6327
6330
} ) ;
6328
6331
} ) ;
6329
6332
6333
+ describe ( 'one-way collection bindings' , function ( ) {
6334
+ it ( 'should update isolate scope when origin scope changes' , inject ( function ( ) {
6335
+ $rootScope . collection = [ {
6336
+ name : 'Gabriel' ,
6337
+ value : 18
6338
+ } , {
6339
+ name : 'Tony' ,
6340
+ value : 91
6341
+ } ] ;
6342
+ $rootScope . query = '' ;
6343
+ $rootScope . $apply ( ) ;
6344
+
6345
+ compile ( '<div><span my-component ow-colref="collection | filter:query" $ow-colref$="collection | filter:query">' ) ;
6346
+
6347
+ expect ( componentScope . owColref ) . toEqual ( $rootScope . collection ) ;
6348
+ expect ( componentScope . owColrefAlias ) . toEqual ( componentScope . owColref ) ;
6349
+ expect ( componentScope . $owColrefAlias ) . toEqual ( componentScope . owColref ) ;
6350
+
6351
+ $rootScope . query = 'Gab' ;
6352
+ $rootScope . $apply ( ) ;
6353
+
6354
+ expect ( componentScope . owColref ) . toEqual ( [ $rootScope . collection [ 0 ] ] ) ;
6355
+ expect ( componentScope . owColrefAlias ) . toEqual ( [ $rootScope . collection [ 0 ] ] ) ;
6356
+ expect ( componentScope . $owColrefAlias ) . toEqual ( [ $rootScope . collection [ 0 ] ] ) ;
6357
+ } ) ) ;
6358
+
6359
+ it ( 'should update isolate scope when origin literal object content changes' , inject ( function ( ) {
6360
+ $rootScope . gab = {
6361
+ name : 'Gabriel' ,
6362
+ value : 18
6363
+ } ;
6364
+ $rootScope . tony = {
6365
+ name : 'Tony' ,
6366
+ value : 91
6367
+ } ;
6368
+ $rootScope . $apply ( ) ;
6369
+
6370
+ compile ( '<div><span my-component ow-colref="[gab, tony]" $ow-colref$="[gab, tony]">' ) ;
6371
+
6372
+ expect ( componentScope . owColref ) . toEqual ( [ $rootScope . gab , $rootScope . tony ] ) ;
6373
+ expect ( componentScope . owColrefAlias ) . toEqual ( [ $rootScope . gab , $rootScope . tony ] ) ;
6374
+ expect ( componentScope . $owColrefAlias ) . toEqual ( [ $rootScope . gab , $rootScope . tony ] ) ;
6375
+
6376
+ $rootScope . tony = {
6377
+ name : 'Bob' ,
6378
+ value : 42
6379
+ } ;
6380
+ $rootScope . $apply ( ) ;
6381
+
6382
+ expect ( componentScope . owColref ) . toEqual ( [ $rootScope . gab , $rootScope . tony ] ) ;
6383
+ expect ( componentScope . owColrefAlias ) . toEqual ( [ $rootScope . gab , $rootScope . tony ] ) ;
6384
+ expect ( componentScope . $owColrefAlias ) . toEqual ( [ $rootScope . gab , $rootScope . tony ] ) ;
6385
+ } ) ) ;
6386
+ } ) ;
6387
+
6330
6388
describe ( 'executable expression' , function ( ) {
6331
6389
it ( 'should allow expression execution with locals' , inject ( function ( ) {
6332
6390
compile ( '<div><span my-component expr="count = count + offset" $expr$="count = count + offset">' ) ;
0 commit comments