@@ -920,6 +920,30 @@ describe('datepicker', function() {
920
920
} ) ;
921
921
} ) ;
922
922
923
+ describe ( 'minDate with no initial value' , function ( ) {
924
+ beforeEach ( function ( ) {
925
+ $rootScope . options = { } ;
926
+ $rootScope . date = new Date ( 'September 10, 2010' ) ;
927
+ element = $compile ( '<uib-datepicker ng-model="date" datepicker-options="options"></uib-datepicker>' ) ( $rootScope ) ;
928
+ $rootScope . $digest ( ) ;
929
+ } ) ;
930
+
931
+ it ( 'should toggle appropriately' , function ( ) {
932
+ var buttons = getAllOptionsEl ( ) ;
933
+ angular . forEach ( buttons , function ( button , index ) {
934
+ expect ( angular . element ( button ) . prop ( 'disabled' ) ) . toBe ( false ) ;
935
+ } ) ;
936
+
937
+ $rootScope . options . minDate = new Date ( 'September 12, 2010' ) ;
938
+ $rootScope . $digest ( ) ;
939
+
940
+ refreshedButtons = getAllOptionsEl ( ) ;
941
+ angular . forEach ( refreshedButtons , function ( button , index ) {
942
+ expect ( angular . element ( button ) . prop ( 'disabled' ) ) . toBe ( index < 14 ) ;
943
+ } ) ;
944
+ } ) ;
945
+ } ) ;
946
+
923
947
describe ( 'minDate' , function ( ) {
924
948
beforeEach ( function ( ) {
925
949
$rootScope . options = {
@@ -1019,6 +1043,30 @@ describe('datepicker', function() {
1019
1043
} ) ;
1020
1044
} ) ;
1021
1045
1046
+ describe ( 'maxDate with no initial value' , function ( ) {
1047
+ beforeEach ( function ( ) {
1048
+ $rootScope . options = { } ;
1049
+ $rootScope . date = new Date ( 'September 10, 2010' ) ;
1050
+ element = $compile ( '<uib-datepicker ng-model="date" datepicker-options="options"></uib-datepicker>' ) ( $rootScope ) ;
1051
+ $rootScope . $digest ( ) ;
1052
+ } ) ;
1053
+
1054
+ it ( 'should toggle appropriately' , function ( ) {
1055
+ var buttons = getAllOptionsEl ( ) ;
1056
+ angular . forEach ( buttons , function ( button , index ) {
1057
+ expect ( angular . element ( button ) . prop ( 'disabled' ) ) . toBe ( false ) ;
1058
+ } ) ;
1059
+
1060
+ $rootScope . options . maxDate = new Date ( 'September 25, 2010' ) ;
1061
+ $rootScope . $digest ( ) ;
1062
+
1063
+ refreshedButtons = getAllOptionsEl ( ) ;
1064
+ angular . forEach ( refreshedButtons , function ( button , index ) {
1065
+ expect ( angular . element ( button ) . prop ( 'disabled' ) ) . toBe ( index > 27 ) ;
1066
+ } ) ;
1067
+ } ) ;
1068
+ } ) ;
1069
+
1022
1070
describe ( 'maxDate' , function ( ) {
1023
1071
beforeEach ( function ( ) {
1024
1072
$rootScope . options = {
0 commit comments