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 22< html ng-app ="test ">
33< head >
44 < meta charset ="utf-8 ">
5- < title > Boostrap Schema Form example</ title >
5+ < title > Bootstrap Schema Form example</ title >
66 < link rel ="stylesheet " href ="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css ">
77 < link rel ="stylesheet " href ="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css ">
88 < 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) {
2020 'bower_components/tv4/tv4.js' ,
2121 'src/module.js' ,
2222 'src/services/*.js' ,
23- 'src/directives/**/*.js' ,
23+ 'src/directives/*.js' ,
24+ 'src/directives/decorators/bootstrap/*.js' ,
25+ 'src/directives/decorators/bootstrap/datepicker/*.js' ,
2426 'src/**/*.html' ,
2527 'test/*.js'
2628 ] ,
Original file line number Diff line number Diff line change @@ -805,6 +805,53 @@ describe('Schema form',function(){
805805 } ) ;
806806
807807
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+
808855 } ) ;
809856
810857
You can’t perform that action at this time.
0 commit comments