@@ -3,16 +3,18 @@ describe('Binder', function(){
33 beforeEach ( function ( ) {
44 var self = this ;
55
6- this . compile = function ( html , initialScope , parent ) {
6+ this . compile = function ( html , parent ) {
77 var compiler = new Compiler ( angularTextMarkup , angularAttrMarkup , angularDirective , angularWidget ) ;
88 if ( self . element ) dealoc ( self . element ) ;
9- var element = self . element = jqLite ( html ) ;
9+ var element ;
10+ if ( parent ) {
11+ parent . html ( html ) ;
12+ element = parent . children ( ) ;
13+ } else {
14+ element = jqLite ( html ) ;
15+ }
16+ self . element = element ;
1017 var scope = compiler . compile ( element ) ( element ) ;
11-
12- if ( parent ) parent . append ( element ) ;
13-
14- extend ( scope , initialScope ) ;
15- scope . $init ( ) ;
1618 return { node :element , scope :scope } ;
1719 } ;
1820 this . compileToHtml = function ( content ) {
@@ -27,8 +29,8 @@ describe('Binder', function(){
2729 } ) ;
2830
2931
30- it ( 'ChangingTextfieldUpdatesModel ' , function ( ) {
31- var state = this . compile ( '<input type="text" name="model.price" value="abc">' , { model : { } } ) ;
32+ it ( 'text-field should default to value attribute ' , function ( ) {
33+ var state = this . compile ( '<input type="text" name="model.price" value="abc">' ) ;
3234 state . scope . $eval ( ) ;
3335 assertEquals ( 'abc' , state . scope . model . price ) ;
3436 } ) ;
@@ -443,8 +445,7 @@ describe('Binder', function(){
443445 } ) ;
444446
445447 it ( 'ActionOnAHrefThrowsError' , function ( ) {
446- var model = { books :[ ] } ;
447- var c = this . compile ( '<a ng:click="action()">Add Phone</a>' , model ) ;
448+ var c = this . compile ( '<a ng:click="action()">Add Phone</a>' ) ;
448449 c . scope . action = function ( ) {
449450 throw new Error ( 'MyError' ) ;
450451 } ;
@@ -517,9 +518,9 @@ describe('Binder', function(){
517518 } ) ;
518519
519520 it ( 'ValidateForm' , function ( ) {
520- var c = this . compile ( '<div><input name="name" ng:required>' +
521- '<div ng:repeat="item in items"><input name="item.name" ng:required/></div ></div>' ,
522- undefined , jqLite ( document . body ) ) ;
521+ var c = this . compile ( '<div id="test" ><input name="name" ng:required>' +
522+ '<input ng:repeat="item in items" name="item.name" ng:required/></div>' ,
523+ jqLite ( document . body ) ) ;
523524 var items = [ { } , { } ] ;
524525 c . scope . $set ( "items" , items ) ;
525526 c . scope . $eval ( ) ;
@@ -547,7 +548,7 @@ describe('Binder', function(){
547548 } ) ;
548549
549550 it ( 'ValidateOnlyVisibleItems' , function ( ) {
550- var c = this . compile ( '<div><input name="name" ng:required><input ng:show="show" name="name" ng:required></div>' , undefined , jqLite ( document . body ) ) ;
551+ var c = this . compile ( '<div><input name="name" ng:required><input ng:show="show" name="name" ng:required></div>' , jqLite ( document . body ) ) ;
551552 c . scope . $set ( "show" , true ) ;
552553 c . scope . $eval ( ) ;
553554 assertEquals ( 2 , c . scope . $service ( '$invalidWidgets' ) . length ) ;
0 commit comments