File tree Expand file tree Collapse file tree 3 files changed +51
-2
lines changed Expand file tree Collapse file tree 3 files changed +51
-2
lines changed Original file line number Diff line number Diff line change 2
2
< html ng-app ="test ">
3
3
< head >
4
4
< meta charset ="utf-8 ">
5
- < title > Boostrap Schema Form example</ title >
5
+ < title > Bootstrap Schema Form example</ title >
6
6
< link rel ="stylesheet " href ="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css ">
7
7
< link rel ="stylesheet " href ="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css ">
8
8
< link rel ="stylesheet " href ="../bower_components/pickadate/lib/themes/classic.css ">
Original file line number Diff line number Diff line change @@ -20,7 +20,9 @@ module.exports = function(config) {
20
20
'bower_components/tv4/tv4.js' ,
21
21
'src/module.js' ,
22
22
'src/services/*.js' ,
23
- 'src/directives/**/*.js' ,
23
+ 'src/directives/*.js' ,
24
+ 'src/directives/decorators/bootstrap/*.js' ,
25
+ 'src/directives/decorators/bootstrap/datepicker/*.js' ,
24
26
'src/**/*.html' ,
25
27
'test/*.js'
26
28
] ,
Original file line number Diff line number Diff line change @@ -805,6 +805,53 @@ describe('Schema form',function(){
805
805
} ) ;
806
806
807
807
808
+ it ( 'should use datepicker directive when format is "date"' , function ( ) {
809
+
810
+ //Mock pickadate
811
+ $ . fn . pickadate = sinon . stub ( ) . returns ( {
812
+ set : sinon . stub ( ) ,
813
+ get : sinon . stub ( ) . returns ( 'get' )
814
+ } ) ;
815
+ $ . fn . pickadate . defaults = { format : 'yyyy-mm-dd' } ;
816
+
817
+ inject ( function ( $compile , $rootScope ) {
818
+ var scope = $rootScope . $new ( ) ;
819
+ scope . person = { partee : '2014-01-01' } ;
820
+
821
+ scope . schema = {
822
+ type : "object" ,
823
+ properties : {
824
+ partee : {
825
+ title : "Parteeeeee" ,
826
+ type : "string" ,
827
+ format : "date"
828
+ }
829
+ }
830
+ } ;
831
+
832
+
833
+ scope . form = [ {
834
+ key :'partee' ,
835
+ maxDate : new Date ( ) ,
836
+ minDate : '2014-02-13' ,
837
+ } ] ;
838
+
839
+ var tmpl = angular . element ( '<form sf-schema="schema" sf-form="form" sf-model="person"></form>' ) ;
840
+
841
+ $compile ( tmpl ) ( scope ) ;
842
+ $rootScope . $apply ( ) ;
843
+ tmpl . children ( ) . length . should . be . equal ( 1 ) ;
844
+ tmpl . children ( ) . eq ( 0 ) . is ( 'div' ) . should . be . true ;
845
+ tmpl . children ( ) . eq ( 0 ) . find ( 'input[pick-a-date]' ) . length . should . ok ;
846
+ tmpl . children ( ) . eq ( 0 ) . find ( 'input[pick-a-date]' ) . attr ( 'max-date' ) . should . be . ok ;
847
+ tmpl . children ( ) . eq ( 0 ) . find ( 'input[pick-a-date]' ) . attr ( 'min-date' ) . should . be . ok ;
848
+
849
+ $ . fn . pickadate . should . have . beenCalled ;
850
+
851
+ } ) ;
852
+ } ) ;
853
+
854
+
808
855
} ) ;
809
856
810
857
You can’t perform that action at this time.
0 commit comments