@@ -4701,21 +4701,28 @@ describe('$compile', function() {
4701
4701
scope : {
4702
4702
attr : '@' ,
4703
4703
attrAlias : '@attr' ,
4704
+ $attrAlias : '@$attr$' ,
4704
4705
ref : '=' ,
4705
4706
refAlias : '= ref' ,
4707
+ $refAlias : '= $ref$' ,
4706
4708
reference : '=' ,
4707
4709
optref : '=?' ,
4708
4710
optrefAlias : '=? optref' ,
4711
+ $optrefAlias : '=? $optref$' ,
4709
4712
optreference : '=?' ,
4710
4713
colref : '=*' ,
4711
4714
colrefAlias : '=* colref' ,
4715
+ $colrefAlias : '=* $colref$' ,
4712
4716
owRef : '<' ,
4713
4717
owRefAlias : '< owRef' ,
4718
+ $owRefAlias : '< $owRef$' ,
4714
4719
owOptref : '<?' ,
4715
4720
owOptrefAlias : '<? owOptref' ,
4721
+ $owOptrefAlias : '<? $owOptref$' ,
4716
4722
expr : '&' ,
4717
4723
optExpr : '&?' ,
4718
4724
exprAlias : '&expr' ,
4725
+ $exprAlias : '&$expr$' ,
4719
4726
constructor : '&?'
4720
4727
} ,
4721
4728
link : function ( scope ) {
@@ -5134,68 +5141,77 @@ describe('$compile', function() {
5134
5141
5135
5142
describe ( 'attribute' , function ( ) {
5136
5143
it ( 'should copy simple attribute' , inject ( function ( ) {
5137
- compile ( '<div><span my-component attr="some text">' ) ;
5144
+ compile ( '<div><span my-component attr="some text" $attr$="some other text" >' ) ;
5138
5145
5139
5146
expect ( componentScope . attr ) . toEqual ( 'some text' ) ;
5140
5147
expect ( componentScope . attrAlias ) . toEqual ( 'some text' ) ;
5148
+ expect ( componentScope . $attrAlias ) . toEqual ( 'some other text' ) ;
5141
5149
expect ( componentScope . attrAlias ) . toEqual ( componentScope . attr ) ;
5142
5150
} ) ) ;
5143
5151
5152
+ expect ( componentScope . $attrAlias ) . toEqual ( ' some other text ' ) ;
5144
5153
it ( 'should set up the interpolation before it reaches the link function' , inject ( function ( ) {
5145
5154
$rootScope . name = 'misko' ;
5146
- compile ( '<div><span my-component attr="hello {{name}}">' ) ;
5155
+ compile ( '<div><span my-component attr="hello {{name}}" $attr$="hi {{name}}" >' ) ;
5147
5156
expect ( componentScope . attr ) . toEqual ( 'hello misko' ) ;
5148
5157
expect ( componentScope . attrAlias ) . toEqual ( 'hello misko' ) ;
5158
+ expect ( componentScope . $attrAlias ) . toEqual ( 'hi misko' ) ;
5149
5159
} ) ) ;
5150
5160
5151
5161
it ( 'should update when interpolated attribute updates' , inject ( function ( ) {
5152
- compile ( '<div><span my-component attr="hello {{name}}">' ) ;
5162
+ compile ( '<div><span my-component attr="hello {{name}}" $attr$="hi {{name}}" >' ) ;
5153
5163
5154
5164
$rootScope . name = 'igor' ;
5155
5165
$rootScope . $apply ( ) ;
5156
5166
5157
5167
expect ( componentScope . attr ) . toEqual ( 'hello igor' ) ;
5158
5168
expect ( componentScope . attrAlias ) . toEqual ( 'hello igor' ) ;
5169
+ expect ( componentScope . $attrAlias ) . toEqual ( 'hi igor' ) ;
5159
5170
} ) ) ;
5160
5171
} ) ;
5161
5172
5162
5173
5163
5174
describe ( 'object reference' , function ( ) {
5164
5175
it ( 'should update local when origin changes' , inject ( function ( ) {
5165
- compile ( '<div><span my-component ref="name">' ) ;
5176
+ compile ( '<div><span my-component ref="name" $ref$="name" >' ) ;
5166
5177
expect ( componentScope . ref ) . toBeUndefined ( ) ;
5167
5178
expect ( componentScope . refAlias ) . toBe ( componentScope . ref ) ;
5179
+ expect ( componentScope . $refAlias ) . toBe ( componentScope . ref ) ;
5168
5180
5169
5181
$rootScope . name = 'misko' ;
5170
5182
$rootScope . $apply ( ) ;
5171
5183
5172
5184
expect ( $rootScope . name ) . toBe ( 'misko' ) ;
5173
5185
expect ( componentScope . ref ) . toBe ( 'misko' ) ;
5174
5186
expect ( componentScope . refAlias ) . toBe ( 'misko' ) ;
5187
+ expect ( componentScope . $refAlias ) . toBe ( 'misko' ) ;
5175
5188
5176
5189
$rootScope . name = { } ;
5177
5190
$rootScope . $apply ( ) ;
5178
5191
expect ( componentScope . ref ) . toBe ( $rootScope . name ) ;
5179
5192
expect ( componentScope . refAlias ) . toBe ( $rootScope . name ) ;
5193
+ expect ( componentScope . $refAlias ) . toBe ( $rootScope . name ) ;
5180
5194
} ) ) ;
5181
5195
5182
5196
5183
5197
it ( 'should update local when both change' , inject ( function ( ) {
5184
- compile ( '<div><span my-component ref="name">' ) ;
5198
+ compile ( '<div><span my-component ref="name" $ref$="name" >' ) ;
5185
5199
$rootScope . name = { mark :123 } ;
5186
5200
componentScope . ref = 'misko' ;
5187
5201
5188
5202
$rootScope . $apply ( ) ;
5189
5203
expect ( $rootScope . name ) . toEqual ( { mark :123 } ) ;
5190
5204
expect ( componentScope . ref ) . toBe ( $rootScope . name ) ;
5191
5205
expect ( componentScope . refAlias ) . toBe ( $rootScope . name ) ;
5206
+ expect ( componentScope . $refAlias ) . toBe ( $rootScope . name ) ;
5192
5207
5193
5208
$rootScope . name = 'igor' ;
5194
5209
componentScope . ref = { } ;
5195
5210
$rootScope . $apply ( ) ;
5196
5211
expect ( $rootScope . name ) . toEqual ( 'igor' ) ;
5197
5212
expect ( componentScope . ref ) . toBe ( $rootScope . name ) ;
5198
5213
expect ( componentScope . refAlias ) . toBe ( $rootScope . name ) ;
5214
+ expect ( componentScope . $refAlias ) . toBe ( $rootScope . name ) ;
5199
5215
} ) ) ;
5200
5216
5201
5217
it ( 'should not break if local and origin both change to the same value' , inject ( function ( ) {
@@ -5325,26 +5341,30 @@ describe('$compile', function() {
5325
5341
5326
5342
describe ( 'optional object reference' , function ( ) {
5327
5343
it ( 'should update local when origin changes' , inject ( function ( ) {
5328
- compile ( '<div><span my-component optref="name">' ) ;
5344
+ compile ( '<div><span my-component optref="name" $optref$="name" >' ) ;
5329
5345
expect ( componentScope . optRef ) . toBeUndefined ( ) ;
5330
5346
expect ( componentScope . optRefAlias ) . toBe ( componentScope . optRef ) ;
5347
+ expect ( componentScope . $optRefAlias ) . toBe ( componentScope . optRef ) ;
5331
5348
5332
5349
$rootScope . name = 'misko' ;
5333
5350
$rootScope . $apply ( ) ;
5334
5351
expect ( componentScope . optref ) . toBe ( $rootScope . name ) ;
5335
5352
expect ( componentScope . optrefAlias ) . toBe ( $rootScope . name ) ;
5353
+ expect ( componentScope . $optrefAlias ) . toBe ( $rootScope . name ) ;
5336
5354
5337
5355
$rootScope . name = { } ;
5338
5356
$rootScope . $apply ( ) ;
5339
5357
expect ( componentScope . optref ) . toBe ( $rootScope . name ) ;
5340
5358
expect ( componentScope . optrefAlias ) . toBe ( $rootScope . name ) ;
5359
+ expect ( componentScope . $optrefAlias ) . toBe ( $rootScope . name ) ;
5341
5360
} ) ) ;
5342
5361
5343
5362
it ( 'should not throw exception when reference does not exist' , inject ( function ( ) {
5344
5363
compile ( '<div><span my-component>' ) ;
5345
5364
5346
5365
expect ( componentScope . optref ) . toBeUndefined ( ) ;
5347
5366
expect ( componentScope . optrefAlias ) . toBeUndefined ( ) ;
5367
+ expect ( componentScope . $optrefAlias ) . toBeUndefined ( ) ;
5348
5368
expect ( componentScope . optreference ) . toBeUndefined ( ) ;
5349
5369
} ) ) ;
5350
5370
} ) ;
@@ -5362,16 +5382,18 @@ describe('$compile', function() {
5362
5382
$rootScope . query = '' ;
5363
5383
$rootScope . $apply ( ) ;
5364
5384
5365
- compile ( '<div><span my-component colref="collection | filter:query">' ) ;
5385
+ compile ( '<div><span my-component colref="collection | filter:query" $colref$="collection | filter:query" >' ) ;
5366
5386
5367
5387
expect ( componentScope . colref ) . toEqual ( $rootScope . collection ) ;
5368
5388
expect ( componentScope . colrefAlias ) . toEqual ( componentScope . colref ) ;
5389
+ expect ( componentScope . $colrefAlias ) . toEqual ( componentScope . colref ) ;
5369
5390
5370
5391
$rootScope . query = 'Gab' ;
5371
5392
$rootScope . $apply ( ) ;
5372
5393
5373
5394
expect ( componentScope . colref ) . toEqual ( [ $rootScope . collection [ 0 ] ] ) ;
5374
5395
expect ( componentScope . colrefAlias ) . toEqual ( [ $rootScope . collection [ 0 ] ] ) ;
5396
+ expect ( componentScope . $colrefAlias ) . toEqual ( [ $rootScope . collection [ 0 ] ] ) ;
5375
5397
} ) ) ;
5376
5398
5377
5399
it ( 'should update origin scope when isolate scope changes' , inject ( function ( ) {
@@ -5399,23 +5421,26 @@ describe('$compile', function() {
5399
5421
5400
5422
describe ( 'one-way binding' , function ( ) {
5401
5423
it ( 'should update isolate when the identity of origin changes' , inject ( function ( ) {
5402
- compile ( '<div><span my-component ow-ref="obj">' ) ;
5424
+ compile ( '<div><span my-component ow-ref="obj" $ow-ref$="obj" >' ) ;
5403
5425
5404
5426
expect ( componentScope . owRef ) . toBeUndefined ( ) ;
5405
5427
expect ( componentScope . owRefAlias ) . toBe ( componentScope . owRef ) ;
5428
+ expect ( componentScope . $owRefAlias ) . toBe ( componentScope . owRef ) ;
5406
5429
5407
5430
$rootScope . obj = { value : 'initial' } ;
5408
5431
$rootScope . $apply ( ) ;
5409
5432
5410
5433
expect ( $rootScope . obj ) . toEqual ( { value : 'initial' } ) ;
5411
5434
expect ( componentScope . owRef ) . toEqual ( { value : 'initial' } ) ;
5412
5435
expect ( componentScope . owRefAlias ) . toBe ( componentScope . owRef ) ;
5436
+ expect ( componentScope . $owRefAlias ) . toBe ( componentScope . owRef ) ;
5413
5437
5414
5438
// This changes in both scopes because of reference
5415
5439
$rootScope . obj . value = 'origin1' ;
5416
5440
$rootScope . $apply ( ) ;
5417
5441
expect ( componentScope . owRef . value ) . toBe ( 'origin1' ) ;
5418
5442
expect ( componentScope . owRefAlias . value ) . toBe ( 'origin1' ) ;
5443
+ expect ( componentScope . $owRefAlias . value ) . toBe ( 'origin1' ) ;
5419
5444
5420
5445
componentScope . owRef = { value : 'isolate1' } ;
5421
5446
componentScope . $apply ( ) ;
@@ -5426,17 +5451,19 @@ describe('$compile', function() {
5426
5451
$rootScope . $apply ( ) ;
5427
5452
expect ( componentScope . owRef . value ) . toBe ( 'isolate1' ) ;
5428
5453
expect ( componentScope . owRefAlias . value ) . toBe ( 'origin2' ) ;
5454
+ expect ( componentScope . $owRefAlias . value ) . toBe ( 'origin2' ) ;
5429
5455
5430
5456
// Change does propagate because object identity changes
5431
5457
$rootScope . obj = { value : 'origin3' } ;
5432
5458
$rootScope . $apply ( ) ;
5433
5459
expect ( componentScope . owRef . value ) . toBe ( 'origin3' ) ;
5434
5460
expect ( componentScope . owRef ) . toBe ( $rootScope . obj ) ;
5435
5461
expect ( componentScope . owRefAlias ) . toBe ( $rootScope . obj ) ;
5462
+ expect ( componentScope . $owRefAlias ) . toBe ( $rootScope . obj ) ;
5436
5463
} ) ) ;
5437
5464
5438
5465
it ( 'should update isolate when both change' , inject ( function ( ) {
5439
- compile ( '<div><span my-component ow-ref="name">' ) ;
5466
+ compile ( '<div><span my-component ow-ref="name" $ow-ref$="name" >' ) ;
5440
5467
5441
5468
$rootScope . name = { mark :123 } ;
5442
5469
componentScope . owRef = 'misko' ;
@@ -5445,13 +5472,15 @@ describe('$compile', function() {
5445
5472
expect ( $rootScope . name ) . toEqual ( { mark :123 } ) ;
5446
5473
expect ( componentScope . owRef ) . toBe ( $rootScope . name ) ;
5447
5474
expect ( componentScope . owRefAlias ) . toBe ( $rootScope . name ) ;
5475
+ expect ( componentScope . $owRefAlias ) . toBe ( $rootScope . name ) ;
5448
5476
5449
5477
$rootScope . name = 'igor' ;
5450
5478
componentScope . owRef = { } ;
5451
5479
$rootScope . $apply ( ) ;
5452
5480
expect ( $rootScope . name ) . toEqual ( 'igor' ) ;
5453
5481
expect ( componentScope . owRef ) . toBe ( $rootScope . name ) ;
5454
5482
expect ( componentScope . owRefAlias ) . toBe ( $rootScope . name ) ;
5483
+ expect ( componentScope . $owRefAlias ) . toBe ( $rootScope . name ) ;
5455
5484
} ) ) ;
5456
5485
5457
5486
describe ( 'initialization' , function ( ) {
@@ -5648,17 +5677,19 @@ describe('$compile', function() {
5648
5677
5649
5678
it ( 'should not update origin when identity of isolate changes' , inject ( function ( ) {
5650
5679
$rootScope . name = { mark :123 } ;
5651
- compile ( '<div><span my-component ow-ref="name">' ) ;
5680
+ compile ( '<div><span my-component ow-ref="name" $ow-ref$="name" >' ) ;
5652
5681
5653
5682
expect ( $rootScope . name ) . toEqual ( { mark :123 } ) ;
5654
5683
expect ( componentScope . owRef ) . toBe ( $rootScope . name ) ;
5655
5684
expect ( componentScope . owRefAlias ) . toBe ( $rootScope . name ) ;
5685
+ expect ( componentScope . $owRefAlias ) . toBe ( $rootScope . name ) ;
5656
5686
5657
5687
componentScope . owRef = 'martin' ;
5658
5688
$rootScope . $apply ( ) ;
5659
5689
expect ( $rootScope . name ) . toEqual ( { mark : 123 } ) ;
5660
5690
expect ( componentScope . owRef ) . toBe ( 'martin' ) ;
5661
5691
expect ( componentScope . owRefAlias ) . toEqual ( { mark : 123 } ) ;
5692
+ expect ( componentScope . $owRefAlias ) . toEqual ( { mark : 123 } ) ;
5662
5693
} ) ) ;
5663
5694
5664
5695
@@ -5805,45 +5836,51 @@ describe('$compile', function() {
5805
5836
5806
5837
describe ( 'optional one-way binding' , function ( ) {
5807
5838
it ( 'should update local when origin changes' , inject ( function ( ) {
5808
- compile ( '<div><span my-component ow-optref="name">' ) ;
5839
+ compile ( '<div><span my-component ow-optref="name" $ow-optref$="name" >' ) ;
5809
5840
5810
5841
expect ( componentScope . owOptref ) . toBeUndefined ( ) ;
5811
5842
expect ( componentScope . owOptrefAlias ) . toBe ( componentScope . owOptref ) ;
5843
+ expect ( componentScope . $owOptrefAlias ) . toBe ( componentScope . owOptref ) ;
5812
5844
5813
5845
$rootScope . name = 'misko' ;
5814
5846
$rootScope . $apply ( ) ;
5815
5847
expect ( componentScope . owOptref ) . toBe ( $rootScope . name ) ;
5816
5848
expect ( componentScope . owOptrefAlias ) . toBe ( $rootScope . name ) ;
5849
+ expect ( componentScope . $owOptrefAlias ) . toBe ( $rootScope . name ) ;
5817
5850
5818
5851
$rootScope . name = { } ;
5819
5852
$rootScope . $apply ( ) ;
5820
5853
expect ( componentScope . owOptref ) . toBe ( $rootScope . name ) ;
5821
5854
expect ( componentScope . owOptrefAlias ) . toBe ( $rootScope . name ) ;
5855
+ expect ( componentScope . $owOptrefAlias ) . toBe ( $rootScope . name ) ;
5822
5856
} ) ) ;
5823
5857
5824
5858
it ( 'should not throw exception when reference does not exist' , inject ( function ( ) {
5825
5859
compile ( '<div><span my-component>' ) ;
5826
5860
5827
5861
expect ( componentScope . owOptref ) . toBeUndefined ( ) ;
5828
5862
expect ( componentScope . owOptrefAlias ) . toBeUndefined ( ) ;
5863
+ expect ( componentScope . $owOptrefAlias ) . toBeUndefined ( ) ;
5829
5864
} ) ) ;
5830
5865
} ) ;
5831
5866
} ) ;
5832
5867
} ) ;
5833
5868
5834
5869
describe ( 'executable expression' , function ( ) {
5835
5870
it ( 'should allow expression execution with locals' , inject ( function ( ) {
5836
- compile ( '<div><span my-component expr="count = count + offset">' ) ;
5871
+ compile ( '<div><span my-component expr="count = count + offset" $expr$="count = count + offset" >' ) ;
5837
5872
$rootScope . count = 2 ;
5838
5873
5839
5874
expect ( typeof componentScope . expr ) . toBe ( 'function' ) ;
5840
5875
expect ( typeof componentScope . exprAlias ) . toBe ( 'function' ) ;
5876
+ expect ( typeof componentScope . $exprAlias ) . toBe ( 'function' ) ;
5841
5877
5842
5878
expect ( componentScope . expr ( { offset : 1 } ) ) . toEqual ( 3 ) ;
5843
5879
expect ( $rootScope . count ) . toEqual ( 3 ) ;
5844
5880
5845
5881
expect ( componentScope . exprAlias ( { offset : 10 } ) ) . toEqual ( 13 ) ;
5846
- expect ( $rootScope . count ) . toEqual ( 13 ) ;
5882
+ expect ( componentScope . $exprAlias ( { offset : 10 } ) ) . toEqual ( 23 ) ;
5883
+ expect ( $rootScope . count ) . toEqual ( 23 ) ;
5847
5884
} ) ) ;
5848
5885
} ) ;
5849
5886
@@ -5861,17 +5898,21 @@ describe('$compile', function() {
5861
5898
expect ( componentScope . $$isolateBindings . attr . mode ) . toBe ( '@' ) ;
5862
5899
expect ( componentScope . $$isolateBindings . attr . attrName ) . toBe ( 'attr' ) ;
5863
5900
expect ( componentScope . $$isolateBindings . attrAlias . attrName ) . toBe ( 'attr' ) ;
5901
+ expect ( componentScope . $$isolateBindings . $attrAlias . attrName ) . toBe ( '$attr$' ) ;
5864
5902
expect ( componentScope . $$isolateBindings . ref . mode ) . toBe ( '=' ) ;
5865
5903
expect ( componentScope . $$isolateBindings . ref . attrName ) . toBe ( 'ref' ) ;
5866
5904
expect ( componentScope . $$isolateBindings . refAlias . attrName ) . toBe ( 'ref' ) ;
5905
+ expect ( componentScope . $$isolateBindings . $refAlias . attrName ) . toBe ( '$ref$' ) ;
5867
5906
expect ( componentScope . $$isolateBindings . reference . mode ) . toBe ( '=' ) ;
5868
5907
expect ( componentScope . $$isolateBindings . reference . attrName ) . toBe ( 'reference' ) ;
5869
5908
expect ( componentScope . $$isolateBindings . owRef . mode ) . toBe ( '<' ) ;
5870
5909
expect ( componentScope . $$isolateBindings . owRef . attrName ) . toBe ( 'owRef' ) ;
5871
5910
expect ( componentScope . $$isolateBindings . owRefAlias . attrName ) . toBe ( 'owRef' ) ;
5911
+ expect ( componentScope . $$isolateBindings . $owRefAlias . attrName ) . toBe ( '$owRef$' ) ;
5872
5912
expect ( componentScope . $$isolateBindings . expr . mode ) . toBe ( '&' ) ;
5873
5913
expect ( componentScope . $$isolateBindings . expr . attrName ) . toBe ( 'expr' ) ;
5874
5914
expect ( componentScope . $$isolateBindings . exprAlias . attrName ) . toBe ( 'expr' ) ;
5915
+ expect ( componentScope . $$isolateBindings . $exprAlias . attrName ) . toBe ( '$expr$' ) ;
5875
5916
5876
5917
var firstComponentScope = componentScope ,
5877
5918
first$$isolateBindings = componentScope . $$isolateBindings ;
0 commit comments