@@ -454,106 +454,7 @@ describe('directive',function(){
454454 } ) ;
455455 } ) ;
456456
457- it ( 'should use ng-required on required fields' , function ( ) {
458-
459- inject ( function ( $compile , $rootScope ) {
460- var scope = $rootScope . $new ( ) ;
461- scope . person = { } ;
462-
463- scope . schema = {
464- "type" : "object" ,
465- "required" : [ "name" ] ,
466- "properties" : {
467- "name" : { "type" : "string" } ,
468- "nick" : { "type" : "string" }
469- }
470- } ;
471-
472- scope . form = [ "*" ] ;
473-
474- var tmpl = angular . element ( '<form sf-schema="schema" sf-form="form" sf-model="person"></form>' ) ;
475-
476- $compile ( tmpl ) ( scope ) ;
477- $rootScope . $apply ( ) ;
478-
479- tmpl . children ( ) . length . should . be . equal ( 2 ) ;
480- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . is ( 'div.form-group' ) . should . be . true ;
481- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . find ( 'input' ) . is ( 'input[type="text"]' ) . should . be . true ;
482- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . find ( 'input' ) . attr ( 'ng-model-options' ) . should . be . equal ( 'form.ngModelOptions' )
483- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . find ( 'input' ) . attr ( 'ng-model' ) . should . be . equal ( 'model[\'name\']' ) ;
484- tmpl . children ( ) . eq ( 1 ) . children ( ) . eq ( 0 ) . is ( 'div.form-group' ) . should . be . true ;
485- tmpl . children ( ) . eq ( 1 ) . children ( ) . eq ( 0 ) . children ( 'input' ) . length . should . equal ( 1 ) ;
486- expect ( tmpl . children ( ) . eq ( 1 ) . children ( ) . eq ( 0 ) . children ( 'input' ) . attr ( 'required' ) ) . to . be . undefined ;
487- } ) ;
488- } ) ;
489-
490- it ( 'should use ng-required on required fields, json schema v3' , function ( ) {
491-
492- inject ( function ( $compile , $rootScope ) {
493- var scope = $rootScope . $new ( ) ;
494- scope . person = { } ;
495-
496- scope . schema = {
497- "type" : "object" ,
498- "properties" : {
499- "name" : { "type" : "string" , "required" : true } ,
500- "nick" : { "type" : "string" }
501- }
502- } ;
503-
504- scope . form = [ "*" ] ;
505-
506- var tmpl = angular . element ( '<form sf-schema="schema" sf-form="form" sf-model="person"></form>' ) ;
507-
508- $compile ( tmpl ) ( scope ) ;
509- $rootScope . $apply ( ) ;
510-
511- tmpl . children ( ) . length . should . be . equal ( 2 ) ;
512- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . is ( 'div.form-group' ) . should . be . true ;
513- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . find ( 'input' ) . is ( 'input[type="text"]' ) . should . be . true ;
514- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . find ( 'input' ) . attr ( 'ng-model-options' ) . should . be . equal ( 'form.ngModelOptions' )
515- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . find ( 'input' ) . attr ( 'ng-model' ) . should . be . equal ( 'model[\'name\']' ) ;
516- tmpl . children ( ) . eq ( 1 ) . children ( ) . eq ( 0 ) . is ( 'div.form-group' ) . should . be . true ;
517- tmpl . children ( ) . eq ( 1 ) . children ( ) . eq ( 0 ) . children ( 'input' ) . length . should . equal ( 1 ) ;
518- expect ( tmpl . children ( ) . eq ( 1 ) . children ( ) . eq ( 0 ) . children ( 'input' ) . attr ( 'required' ) ) . to . be . undefined ;
519- } ) ;
520- } ) ;
521-
522- it ( 'should use ng-required on required fields, form override' , function ( ) {
523-
524- inject ( function ( $compile , $rootScope ) {
525- var scope = $rootScope . $new ( ) ;
526- scope . person = { } ;
527-
528- scope . schema = {
529- "type" : "object" ,
530- "properties" : {
531- "name" : { "type" : "string" } ,
532- "nick" : { "type" : "string" , "required" : true }
533- }
534- } ;
535-
536- scope . form = [
537- { key : 'name' , required : true } ,
538- { key : 'nick' , required : false } ,
539- ] ;
540-
541- var tmpl = angular . element ( '<form sf-schema="schema" sf-form="form" sf-model="person"></form>' ) ;
542-
543- $compile ( tmpl ) ( scope ) ;
544- $rootScope . $apply ( ) ;
545-
546- tmpl . children ( ) . length . should . be . equal ( 2 ) ;
547- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . is ( 'div.form-group' ) . should . be . true ;
548- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . find ( 'input' ) . is ( 'input[type="text"]' ) . should . be . true ;
549- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . find ( 'input' ) . attr ( 'ng-model-options' ) . should . be . equal ( 'form.ngModelOptions' ) ;
550- tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . find ( 'input' ) . attr ( 'ng-model' ) . should . be . equal ( 'model[\'name\']' ) ;
551- tmpl . children ( ) . eq ( 1 ) . children ( ) . eq ( 0 ) . is ( 'div.form-group' ) . should . be . true ;
552- tmpl . children ( ) . eq ( 1 ) . children ( ) . eq ( 0 ) . children ( 'input' ) . length . should . equal ( 1 ) ;
553- expect ( tmpl . children ( ) . eq ( 1 ) . children ( ) . eq ( 0 ) . children ( 'input' ) . attr ( 'required' ) ) . to . be . undefined ;
554- } ) ;
555- } ) ;
556-
457+
557458 it ( 'should honor defaults in schema' , function ( ) {
558459
559460 inject ( function ( $compile , $rootScope ) {
0 commit comments