@@ -174,34 +174,6 @@ BinderTest.prototype.testButtonElementActionExecutesInScope = function(){
174
174
assertTrue ( savedCalled ) ;
175
175
} ;
176
176
177
- BinderTest . prototype . XtestParseEmptyAnchor = function ( ) {
178
- var binder = this . compile ( "<div/>" ) . binder ;
179
- var location = binder . location ;
180
- var anchor = binder . anchor ;
181
- location . url = "a#x=1" ;
182
- binder . parseAnchor ( ) ;
183
- assertEquals ( 1 , binder . anchor . x ) ;
184
- location . url = "a#" ;
185
- binder . parseAnchor ( ) ;
186
- assertTrue ( "old values did not get removed" , ! binder . anchor . x ) ;
187
- assertTrue ( "anchor gor replaced" , anchor === binder . anchor ) ;
188
- assertEquals ( 'undefined' , typeof ( anchor [ "" ] ) ) ;
189
- } ;
190
-
191
- BinderTest . prototype . XtestParseAnchor = function ( ) {
192
- var binder = this . compile ( "<div/>" ) . binder ;
193
- var location = binder . location ;
194
- location . url = "a#x=1" ;
195
- binder . parseAnchor ( ) ;
196
- assertEquals ( binder . anchor . x , "1" ) ;
197
- location . url = "a#a=b&c=%20&d" ;
198
- binder . parseAnchor ( ) ;
199
- assertEquals ( binder . anchor . a , 'b' ) ;
200
- assertEquals ( binder . anchor . c , ' ' ) ;
201
- assertTrue ( binder . anchor . d !== null ) ;
202
- assertTrue ( ! binder . anchor . x ) ;
203
- } ;
204
-
205
177
BinderTest . prototype . testRepeaterUpdateBindings = function ( ) {
206
178
var a = this . compile ( '<ul><LI ng-repeat="item in model.items" ng-bind="item.a"/></ul>' ) ;
207
179
var form = a . node ;
@@ -355,18 +327,6 @@ BinderTest.prototype.testNestedRepeater = function() {
355
327
'</div></div>' , sortedHtml ( a . node ) ) ;
356
328
} ;
357
329
358
- BinderTest . prototype . XtestRadioButtonGetsPrefixed = function ( ) {
359
- var a = this . compile ( '<div><input ng-repeat="m in model" type="radio" name="m.a" value="on"/></div>' ) ;
360
- a . scope . $set ( 'model' , [ 'a1' , 'a2' ] ) ;
361
- a . scope . $eval ( ) ;
362
-
363
- assertEquals ( '</div>' +
364
- '<#comment></#comment>' +
365
- '<input name="0:m.a" ng-repeat-index="0" type="radio" value="on"></input>' +
366
- '<input name="1:m.a" ng-repeat-index="1" type="radio" value="on"></input></div>' ,
367
- sortedHtml ( a . node ) ) ;
368
- } ;
369
-
370
330
BinderTest . prototype . testHideBindingExpression = function ( ) {
371
331
var a = this . compile ( '<div ng-hide="hidden == 3"/>' ) ;
372
332
@@ -525,31 +485,6 @@ BinderTest.prototype.testShouldTemplateBindPreElements = function () {
525
485
assertEquals ( '<pre ng-bind-template="Hello {{name}}!">Hello World!</pre>' , sortedHtml ( c . node ) ) ;
526
486
} ;
527
487
528
- BinderTest . prototype . XtestDissableAutoSubmit = function ( ) {
529
- var c = this . compile ( '<input type="submit" value="S"/>' , null , { autoSubmit :true } ) ;
530
- assertEquals (
531
- '<input ng-action="$save()" ng-bind-attr="{"disabled":"{{$invalidWidgets}}"}" type="submit" value="S"></input>' ,
532
- sortedHtml ( c . node ) ) ;
533
-
534
- c = this . compile ( '<input type="submit" value="S"/>' , null , { autoSubmit :false } ) ;
535
- assertEquals (
536
- '<input type="submit" value="S"></input>' ,
537
- sortedHtml ( c . node ) ) ;
538
- } ;
539
-
540
- BinderTest . prototype . XtestSettingAnchorToNullOrUndefinedRemovesTheAnchorFromURL = function ( ) {
541
- var c = this . compile ( '' ) ;
542
- c . binder . location . set ( "http://server/#a=1&b=2" ) ;
543
- c . binder . parseAnchor ( ) ;
544
- assertEquals ( '1' , c . binder . anchor . a ) ;
545
- assertEquals ( '2' , c . binder . anchor . b ) ;
546
-
547
- c . binder . anchor . a = null ;
548
- c . binder . anchor . b = null ;
549
- c . binder . updateAnchor ( ) ;
550
- assertEquals ( 'http://server/#' , c . binder . location . get ( ) ) ;
551
- } ;
552
-
553
488
BinderTest . prototype . testFillInOptionValueWhenMissing = function ( ) {
554
489
var c = this . compile (
555
490
'<select><option selected="true">{{a}}</option><option value="">{{b}}</option><option>C</option></select>' ) ;
@@ -570,9 +505,11 @@ BinderTest.prototype.testFillInOptionValueWhenMissing = function() {
570
505
expect ( optionC . text ( ) ) . toEqual ( 'C' ) ;
571
506
} ;
572
507
573
- BinderTest . prototype . XtestValidateForm = function ( ) {
574
- var c = this . compile ( '<input name="name" ng-required>' +
575
- '<div ng-repeat="item in items"><input name="item.name" ng-required/></div>' ) ;
508
+ BinderTest . prototype . testValidateForm = function ( ) {
509
+ var doc = jqLite ( document . body ) ;
510
+ doc . append ( '<div><input name="name" ng-required>' +
511
+ '<div ng-repeat="item in items"><input name="item.name" ng-required/></div></div>' ) ;
512
+ var c = this . compile ( doc ) ;
576
513
var items = [ { } , { } ] ;
577
514
c . scope . $set ( "items" , items ) ;
578
515
c . scope . $eval ( ) ;
@@ -599,8 +536,9 @@ BinderTest.prototype.XtestValidateForm = function() {
599
536
assertEquals ( 0 , c . scope . $get ( "$invalidWidgets.length" ) ) ;
600
537
} ;
601
538
602
- BinderTest . prototype . XtestValidateOnlyVisibleItems = function ( ) {
603
- var c = this . compile ( '<input name="name" ng-required><input ng-show="show" name="name" ng-required>' ) ;
539
+ BinderTest . prototype . testValidateOnlyVisibleItems = function ( ) {
540
+ var c = this . compile ( '<div><input name="name" ng-required><input ng-show="show" name="name" ng-required></div>' ) ;
541
+ jqLite ( document . body ) . append ( c . node ) ;
604
542
c . scope . $set ( "show" , true ) ;
605
543
c . scope . $eval ( ) ;
606
544
assertEquals ( 2 , c . scope . $get ( "$invalidWidgets.length" ) ) ;
@@ -629,62 +567,6 @@ BinderTest.prototype.testDeleteAttributeIfEvaluatesFalse = function() {
629
567
assertChild ( 5 , false ) ;
630
568
} ;
631
569
632
- BinderTest . prototype . XtestItShouldCallListenersWhenAnchorChanges = function ( ) {
633
- var log = "" ;
634
- var c = this . compile ( '<div ng-watch="$anchor.counter:count = count+1">' ) ;
635
- c . scope . $set ( "count" , 0 ) ;
636
- c . scope . $watch ( "$anchor.counter" , function ( newValue , oldValue ) {
637
- log += oldValue + "->" + newValue + ";" ;
638
- } ) ;
639
- assertEquals ( 0 , c . scope . $get ( "count" ) ) ;
640
- c . binder . location . url = "#counter=1" ;
641
- c . binder . onUrlChange ( ) ;
642
- assertEquals ( 1 , c . scope . $get ( "count" ) ) ;
643
-
644
- c . binder . location . url = "#counter=1" ;
645
- c . binder . onUrlChange ( ) ;
646
- assertEquals ( 1 , c . scope . $get ( "count" ) ) ;
647
-
648
- c . binder . location . url = "#counter=2" ;
649
- c . binder . onUrlChange ( ) ;
650
- assertEquals ( 2 , c . scope . $get ( "count" ) ) ;
651
-
652
- c . binder . location . url = "#counter=2" ;
653
- c . binder . onUrlChange ( ) ;
654
- assertEquals ( 2 , c . scope . $get ( "count" ) ) ;
655
-
656
- c . binder . location . url = "#" ;
657
- c . binder . onUrlChange ( ) ;
658
- assertEquals ( "undefined->1;1->2;2->undefined;" , log ) ;
659
- assertEquals ( 3 , c . scope . $get ( "count" ) ) ;
660
- } ;
661
-
662
- BinderTest . prototype . XtestParseQueryString = function ( ) {
663
- var binder = new Binder ( ) ;
664
- assertJsonEquals ( { "a" :"1" } , binder . parseQueryString ( "a=1" ) ) ;
665
- assertJsonEquals ( { "a" :"1" , "b" :"two" } , binder . parseQueryString ( "a=1&b=two" ) ) ;
666
- assertJsonEquals ( { } , binder . parseQueryString ( "" ) ) ;
667
-
668
- assertJsonEquals ( { "a" :"1" , "b" :"" } , binder . parseQueryString ( "a=1&b=" ) ) ;
669
- assertJsonEquals ( { "a" :"1" , "b" :"" } , binder . parseQueryString ( "a=1&b" ) ) ;
670
- assertJsonEquals ( { "a" :"1" , "b" :" 2 " } , binder . parseQueryString ( "a=1&b=%202%20" ) ) ;
671
- assertJsonEquals ( { "a a" :"1" , "b" :"2" } , binder . parseQueryString ( "a%20a=1&b=2" ) ) ;
672
-
673
- } ;
674
-
675
- BinderTest . prototype . XtestSetBinderAnchorTriggersListeners = function ( ) {
676
- expectAsserts ( 2 ) ;
677
- var doc = this . compile ( "<div/>" ) ;
678
-
679
- doc . scope . $watch ( "$anchor.name" , function ( newVal , oldVal ) {
680
- assertEquals ( "new" , newVal ) ;
681
- assertEquals ( undefined , oldVal ) ;
682
- } ) ;
683
-
684
- doc . $anchor . name = "new" ;
685
- doc . binder . onUrlChange ( "http://base#name=new" ) ;
686
- } ;
687
-
688
570
BinderTest . prototype . testItShouldDisplayErrorWhenActionIsSyntacticlyIncorect = function ( ) {
689
571
var c = this . compile ( '<div>' +
690
572
'<input type="button" ng-click="greeting=\'ABC\'"/>' +
@@ -768,9 +650,9 @@ BinderTest.prototype.testItBindHiddenInputFields = function(){
768
650
assertEquals ( "abc" , x . scope . $get ( "myName" ) ) ;
769
651
} ;
770
652
771
- BinderTest . prototype . xtestItShouldRenderMultiRootHtmlInBinding = function ( ) {
653
+ BinderTest . prototype . XtestItShouldRenderMultiRootHtmlInBinding = function ( ) {
772
654
var x = this . compile ( '<div>before {{a|html}}after</div>' ) ;
773
- x . scope . $set ( "a" , "a<b>c</b>d" ) ;
655
+ x . scope . a = "a<b>c</b>d" ;
774
656
x . scope . $eval ( ) ;
775
657
assertEquals (
776
658
'<div>before <span ng-bind="a|html">a<b>c</b>d</span>after</div>' ,
@@ -790,20 +672,3 @@ BinderTest.prototype.testItShouldUseFormaterForText = function() {
790
672
assertEquals ( '1, 2, 3' , input [ 0 ] . value ) ;
791
673
} ;
792
674
793
- BinderTest . prototype . XtestWriteAnchor = function ( ) {
794
- var binder = this . compile ( "<div/>" ) . binder ;
795
- binder . location . set ( 'a' ) ;
796
- binder . anchor . a = 'b' ;
797
- binder . anchor . c = ' ' ;
798
- binder . anchor . d = true ;
799
- binder . updateAnchor ( ) ;
800
- assertEquals ( binder . location . get ( ) , "a#a=b&c=%20&d" ) ;
801
- } ;
802
-
803
- BinderTest . prototype . XtestWriteAnchorAsPartOfTheUpdateView = function ( ) {
804
- var binder = this . compile ( "<div/>" ) . binder ;
805
- binder . location . set ( 'a' ) ;
806
- binder . anchor . a = 'b' ;
807
- binder . updateView ( ) ;
808
- assertEquals ( binder . location . get ( ) , "a#a=b" ) ;
809
- } ;
0 commit comments