@@ -88,6 +88,32 @@ describe('$$testability', function() {
88
88
expect ( names [ 0 ] ) . toBe ( element . find ( 'li' ) [ 0 ] ) ;
89
89
} ) ;
90
90
91
+ it ( 'should find bindings with allowed special characters' , function ( ) {
92
+ element =
93
+ '<div>' +
94
+ ' <span>{{$index}}</span>' +
95
+ ' <span>{{foo.bar}}</span>' +
96
+ ' <span>{{foonbar}}</span>' +
97
+ ' <span>{{foo | uppercase}}</span>' +
98
+ '</div>' ;
99
+ element = $compile ( element ) ( scope ) ;
100
+ var indexes = $$testability . findBindings ( element [ 0 ] , '$index' , true ) ;
101
+ expect ( indexes . length ) . toBe ( 1 ) ;
102
+ expect ( indexes [ 0 ] ) . toBe ( element . find ( 'span' ) [ 0 ] ) ;
103
+
104
+ var foobars = $$testability . findBindings ( element [ 0 ] , 'foo.bar' , true ) ;
105
+ expect ( foobars . length ) . toBe ( 1 ) ; // it should not match {{foonbar}}
106
+ expect ( foobars [ 0 ] ) . toBe ( element . find ( 'span' ) [ 1 ] ) ;
107
+
108
+ var foo = $$testability . findBindings ( element [ 0 ] , 'foo' , true ) ;
109
+ expect ( foo . length ) . toBe ( 1 ) ; // it should match {{foo | uppercase}}
110
+ var uppercase = $$testability . findBindings ( element [ 0 ] , 'uppercase' , true ) ;
111
+ expect ( uppercase . length ) . toBe ( 1 ) ; // it should match {{foo | uppercase}}
112
+ var filteredFoo = $$testability . findBindings ( element [ 0 ] , 'foo | uppercase' , true ) ;
113
+ expect ( filteredFoo . length ) . toBe ( 1 ) ; // it should match {{foo | uppercase}}
114
+ expect ( filteredFoo [ 0 ] ) . toBe ( element . find ( 'span' ) [ 3 ] ) ;
115
+ } ) ;
116
+
91
117
it ( 'should find partial models' , function ( ) {
92
118
element =
93
119
'<div>' +
0 commit comments