@@ -25,11 +25,20 @@ export function main() {
2525 expect ( MapWrapper . get ( results [ 0 ] . propertyBindings , 'a' ) . source ) . toEqual ( 'b' ) ;
2626 } ) ;
2727
28+ it ( 'should detect [] syntax only if an attribute name starts and ends with []' , ( ) => {
29+ expect ( createPipeline ( ) . process ( el ( '<div z[a]="b"></div>' ) ) [ 0 ] . propertyBindings ) . toBe ( null ) ;
30+ expect ( createPipeline ( ) . process ( el ( '<div [a]v="b"></div>' ) ) [ 0 ] . propertyBindings ) . toBe ( null ) ;
31+ } ) ;
32+
2833 it ( 'should detect bind- syntax' , ( ) => {
2934 var results = createPipeline ( ) . process ( el ( '<div bind-a="b"></div>' ) ) ;
3035 expect ( MapWrapper . get ( results [ 0 ] . propertyBindings , 'a' ) . source ) . toEqual ( 'b' ) ;
3136 } ) ;
3237
38+ it ( 'should detect bind- syntax only if an attribute name starts with bind' , ( ) => {
39+ expect ( createPipeline ( ) . process ( el ( '<div _bind-a="b"></div>' ) ) [ 0 ] . propertyBindings ) . toBe ( null ) ;
40+ } ) ;
41+
3342 it ( 'should detect interpolation syntax' , ( ) => {
3443 // Note: we don't test all corner cases of interpolation as we assume shared functionality between text interpolation
3544 // and attribute interpolation.
@@ -62,6 +71,11 @@ export function main() {
6271 expect ( MapWrapper . get ( results [ 0 ] . variableBindings , '\$implicit' ) ) . toEqual ( 'george' ) ;
6372 } ) ;
6473
74+ it ( 'should detect variable bindings only if an attribute name starts with #' , ( ) => {
75+ var results = createPipeline ( ) . process ( el ( '<p b#george></p>' ) ) ;
76+ expect ( results [ 0 ] . variableBindings ) . toBe ( null ) ;
77+ } ) ;
78+
6579 it ( 'should detect () syntax' , ( ) => {
6680 var results = createPipeline ( ) . process ( el ( '<div (click)="b()"></div>' ) ) ;
6781 expect ( MapWrapper . get ( results [ 0 ] . eventBindings , 'click' ) . source ) . toEqual ( 'b()' ) ;
@@ -70,6 +84,11 @@ export function main() {
7084 expect ( MapWrapper . get ( results [ 0 ] . eventBindings , 'click[]' ) . source ) . toEqual ( 'b()' ) ;
7185 } ) ;
7286
87+ it ( 'should detect () syntax only if an attribute name starts and ends with ()' , ( ) => {
88+ expect ( createPipeline ( ) . process ( el ( '<div z(a)="b()"></div>' ) ) [ 0 ] . propertyBindings ) . toBe ( null ) ;
89+ expect ( createPipeline ( ) . process ( el ( '<div (a)v="b()"></div>' ) ) [ 0 ] . propertyBindings ) . toBe ( null ) ;
90+ } ) ;
91+
7392 it ( 'should parse event handlers using () syntax as actions' , ( ) => {
7493 var results = createPipeline ( ) . process ( el ( '<div (click)="foo=bar"></div>' ) ) ;
7594 expect ( MapWrapper . get ( results [ 0 ] . eventBindings , 'click' ) . source ) . toEqual ( 'foo=bar' ) ;
0 commit comments