@@ -62,69 +62,70 @@ describe('Schema form',function(){
6262 } ) ;
6363 } ) ;
6464
65- it ( 'should generate html and compile it, deep structure' , function ( ) {
65+ it . only ( 'should generate html and compile it, deep structure' , function ( ) {
6666
6767 inject ( function ( $compile , $rootScope ) {
6868 var scope = $rootScope . $new ( ) ;
6969 scope . person = { } ;
7070
7171 scope . schema = {
72- " type" : " object" ,
73- " properties" : {
74- " name" : {
75- " title" : " Name" ,
76- " description" : " Gimme yea name lad" ,
77- " type" : " string"
72+ ' type' : ' object' ,
73+ ' properties' : {
74+ ' name' : {
75+ ' title' : ' Name' ,
76+ ' description' : ' Gimme yea name lad' ,
77+ ' type' : ' string'
7878 } ,
79- " ianal" : {
80- " type" : " boolean" ,
81- " title" :'IANAL'
79+ ' ianal' : {
80+ ' type' : ' boolean' ,
81+ ' title' :'IANAL'
8282 } ,
83- " age" : {
84- " type" : " integer" ,
85- " title" :'Age' ,
86- " minimum" : 0
83+ ' age' : {
84+ ' type' : ' integer' ,
85+ ' title' :'Age' ,
86+ ' minimum' : 0
8787 } ,
88- " sum" : {
89- " type" : " number" ,
90- " title" : " summa"
88+ ' sum' : {
89+ ' type' : ' number' ,
90+ ' title' : ' summa'
9191 } ,
92- " gender" : {
93- " title" : " Choose" ,
94- " type" : " string" ,
95- " enum" : [
96- " undefined" ,
97- " null" ,
98- " NaN" ,
92+ ' gender' : {
93+ ' title' : ' Choose' ,
94+ ' type' : ' string' ,
95+ ' enum' : [
96+ ' undefined' ,
97+ ' null' ,
98+ ' NaN' ,
9999 ]
100100 } ,
101- " attributes" : {
102- " type" : " object" ,
103- " title" : " Attributes" ,
104- " required" : [ 'eyecolor' ] ,
105- " properties" : {
106- " eyecolor" : { " type" : " string" , " title" : " Eye color" } ,
107- " haircolor" : { " type" : " string" , " title" : " Hair color" } ,
108- " shoulders" : {
109- " type" : " object" ,
110- " title" : " Shoulders" ,
111- " properties" : {
112- " left" : { " type" : " string" } ,
113- " right" : { " type" : " string" } ,
101+ ' attributes' : {
102+ ' type' : ' object' ,
103+ ' title' : ' Attributes' ,
104+ ' required' : [ 'eyecolor' ] ,
105+ ' properties' : {
106+ ' eyecolor' : { ' type' : ' string' , ' title' : ' Eye color' } ,
107+ ' haircolor' : { ' type' : ' string' , ' title' : ' Hair color' } ,
108+ ' shoulders' : {
109+ ' type' : ' object' ,
110+ ' title' : ' Shoulders' ,
111+ ' properties' : {
112+ ' left' : { ' type' : ' string' } ,
113+ ' right' : { ' type' : ' string' } ,
114114 }
115115 }
116116 }
117117 }
118118 }
119119 } ;
120120
121- scope . form = [ "*" ] ;
121+ scope . form = [ '*' ] ;
122122
123123 var tmpl = angular . element ( '<form sf-schema="schema" sf-form="form" sf-model="person" sf-decorator-name="bootstrap-decorator"></form>' ) ;
124124
125125 $compile ( tmpl ) ( scope ) ;
126126 $rootScope . $apply ( ) ;
127127
128+
128129 tmpl . children ( ) . length . should . be . equal ( 6 ) ;
129130 tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . is ( 'div.form-group' ) . should . be . true ;
130131 tmpl . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . find ( 'input' ) . is ( 'input[type="text"]' ) . should . be . true ;
@@ -145,10 +146,11 @@ describe('Schema form',function(){
145146 tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . is ( 'fieldset' ) . should . be . true ;
146147 tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . children ( ) . eq ( 0 ) . is ( 'legend' ) . should . be . true ;
147148 tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . children ( ) . eq ( 3 ) . is ( 'sf-decorator' ) . should . be . true ;
148- tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . children ( ) . eq ( 3 ) . children ( ) . eq ( 0 ) . is ( 'fieldset' ) . should . be . true ;
149- tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . children ( ) . eq ( 3 ) . children ( ) . eq ( 0 ) . children ( ) . length . should . be . eq ( 3 ) ;
150- tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . children ( ) . eq ( 3 ) . children ( ) . eq ( 0 ) . find ( 'input[ng-model="model[\'attributes\'][\'shoulders\'][\'left\']"]' ) . length . should . be . eq ( 1 ) ;
151- tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . children ( ) . eq ( 3 ) . children ( ) . eq ( 0 ) . find ( 'input[ng-model="model[\'attributes\'][\'shoulders\'][\'right\']"]' ) . length . should . be . eq ( 1 ) ;
149+
150+ tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . children ( ) . eq ( 4 ) . children ( ) . eq ( 0 ) . is ( 'fieldset' ) . should . be . true ;
151+ tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . children ( ) . eq ( 4 ) . children ( ) . eq ( 0 ) . children ( ) . length . should . be . eq ( 4 ) ;
152+ tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . children ( ) . eq ( 4 ) . children ( ) . eq ( 0 ) . find ( 'input[ng-model="model[\'attributes\'][\'shoulders\'][\'left\']"]' ) . length . should . be . eq ( 1 ) ;
153+ tmpl . children ( ) . eq ( 5 ) . children ( ) . eq ( 0 ) . children ( ) . eq ( 4 ) . children ( ) . eq ( 0 ) . find ( 'input[ng-model="model[\'attributes\'][\'shoulders\'][\'right\']"]' ) . length . should . be . eq ( 1 ) ;
152154
153155 } ) ;
154156 } ) ;
0 commit comments