@@ -29,35 +29,57 @@ describe("directives", function(){
2929 expect ( scope . a ) . toEqual ( 2 ) ;
3030 } ) ;
3131
32- it ( 'should ng:bind' , function ( ) {
33- var scope = compile ( '<div ng:bind="a"></div>' ) ;
34- expect ( element . text ( ) ) . toEqual ( '' ) ;
35- scope . a = 'misko' ;
36- scope . $eval ( ) ;
37- expect ( element . text ( ) ) . toEqual ( 'misko' ) ;
38- } ) ;
32+ describe ( 'ng:bind' , function ( ) {
33+ it ( 'should set text' , function ( ) {
34+ var scope = compile ( '<div ng:bind="a"></div>' ) ;
35+ expect ( element . text ( ) ) . toEqual ( '' ) ;
36+ scope . a = 'misko' ;
37+ scope . $eval ( ) ;
38+ expect ( element . text ( ) ) . toEqual ( 'misko' ) ;
39+ } ) ;
3940
40- it ( 'should ng:bind html' , function ( ) {
41- var scope = compile ( '<div ng:bind="html|html"></div>' ) ;
42- scope . html = '<div>hello</div>' ;
43- scope . $eval ( ) ;
44- expect ( lowercase ( element . html ( ) ) ) . toEqual ( '<div>hello</div>' ) ;
45- } ) ;
41+ it ( 'should set html' , function ( ) {
42+ var scope = compile ( '<div ng:bind="html|html"></div>' ) ;
43+ scope . html = '<div>hello</div>' ;
44+ scope . $eval ( ) ;
45+ expect ( lowercase ( element . html ( ) ) ) . toEqual ( '<div>hello</div>' ) ;
46+ } ) ;
47+
48+ it ( 'should set element element' , function ( ) {
49+ angularFilter . myElement = function ( ) {
50+ return jqLite ( '<a>hello</a>' ) ;
51+ } ;
52+ var scope = compile ( '<div ng:bind="0|myElement"></div>' ) ;
53+ scope . $eval ( ) ;
54+ expect ( lowercase ( element . html ( ) ) ) . toEqual ( '<a>hello</a>' ) ;
55+ } ) ;
56+
57+ it ( 'should have $element set to current bind element' , function ( ) {
58+ angularFilter . myFilter = function ( ) {
59+ this . $element . text ( 'HELLO' ) ;
60+ } ;
61+ var scope = compile ( '<div>before<div ng:bind="0|myFilter"></div>after</div>' ) ;
62+ expect ( scope . $element . text ( ) ) . toEqual ( "beforeHELLOafter" ) ;
63+ } ) ;
4664
47- it ( 'should ng:bind element' , function ( ) {
48- angularFilter . myElement = function ( ) {
49- return jqLite ( '<a>hello</a>' ) ;
50- } ;
51- var scope = compile ( '<div ng:bind="0|myElement"></div>' ) ;
52- scope . $eval ( ) ;
53- expect ( lowercase ( element . html ( ) ) ) . toEqual ( '<a>hello</a>' ) ;
5465 } ) ;
5566
56- it ( 'should ng:bind-template' , function ( ) {
57- var scope = compile ( '<div ng:bind-template="Hello {{name}}!"></div>' ) ;
58- scope . $set ( 'name' , 'Misko' ) ;
59- scope . $eval ( ) ;
60- expect ( element . text ( ) ) . toEqual ( 'Hello Misko!' ) ;
67+ describe ( 'ng:bind-template' , function ( ) {
68+ it ( 'should ng:bind-template' , function ( ) {
69+ var scope = compile ( '<div ng:bind-template="Hello {{name}}!"></div>' ) ;
70+ scope . $set ( 'name' , 'Misko' ) ;
71+ scope . $eval ( ) ;
72+ expect ( element . text ( ) ) . toEqual ( 'Hello Misko!' ) ;
73+ } ) ;
74+
75+ it ( 'should have $element set to current bind element' , function ( ) {
76+ angularFilter . myFilter = function ( ) {
77+ this . $element . text ( 'HELLO' ) ;
78+ } ;
79+ var scope = compile ( '<div>before<div ng:bind-template="{{0|myFilter}}"></div>after</div>' ) ;
80+ expect ( scope . $element . text ( ) ) . toEqual ( "beforeHELLOafter" ) ;
81+ } ) ;
82+
6183 } ) ;
6284
6385 it ( 'should ng:bind-attr' , function ( ) {
0 commit comments