Skip to content

Commit 7202863

Browse files
committed
Fix issue with minimizing script and validation function.
1 parent be98596 commit 7202863

File tree

6 files changed

+70
-71
lines changed

6 files changed

+70
-71
lines changed

Gruntfile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = function (grunt) {
2222
options: {
2323
thresholds: {
2424
'statements': 100,
25-
'branches': 95,
25+
'branches': 100,
2626
'lines': 100,
2727
'functions': 100
2828
},
@@ -34,7 +34,7 @@ module.exports = function (grunt) {
3434
unit: {
3535
options: testConfig('karma.conf.js',
3636
{
37-
singleRun: false,
37+
singleRun: true,
3838
autoWatch: true,
3939
keepalive: true,
4040
browsers: ['Chrome']

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Angular bootstrap date & time picker v0.2.2
1+
# Angular bootstrap date & time picker v0.2.3
22
================================
33

44
Native AngularJS datetime picker directive styled by Twitter Bootstrap 3

bower.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-bootstrap-datetimepicker",
3-
"version": "0.2.2",
3+
"version": "0.2.3",
44
"description": "This directive allows you to add a datetime-picker to your form.",
55
"author": "https://github.com/dalelotts/angular-bootstrap-datetimepicker/graphs/contributors",
66
"license": "MIT",
@@ -20,12 +20,12 @@
2020
"package.json"
2121
],
2222
"dependencies": {
23-
"angular": "1.2.14",
24-
"bootstrap": "3.1.0",
25-
"moment": "2.5.1"
23+
"angular": "^1.2.16",
24+
"bootstrap": "^3.1.1",
25+
"moment": "^2.6.0"
2626
},
2727
"devDependencies": {
28-
"angular-mocks": "1.2.14",
29-
"jquery": "2.1.0"
28+
"angular-mocks": "^1.2.16",
29+
"jquery": "^2.1.1"
3030
}
3131
}

karma.conf.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ module.exports = function (config) {
4747

4848
// optionally, configure the reporter
4949
coverageReporter: {
50-
type : 'html',
51-
dir : 'coverage/'
50+
reporters: [
51+
{type: 'json', dir: 'coverage/'},
52+
{type: 'html', dir: 'coverage/'}
53+
]
5254
},
5355

5456
// test results reporter to use

package.json

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-bootstrap-datetimepicker",
3-
"version": "0.2.2",
3+
"version": "0.2.3",
44
"description": "This directive allows you to add a datetime-picker to your form elements.",
55
"author": "https://github.com/dalelotts/ng-bootstrap-datetimepicker/graphs/contributors",
66
"license": "MIT",
@@ -9,17 +9,16 @@
99
"dependencies": {},
1010
"devDependencies": {
1111
"bower": "latest",
12-
"grunt": "0.4.4",
13-
14-
"grunt-contrib-jshint": "0.9.2",
15-
"grunt-istanbul-coverage": "0.0.3",
16-
"grunt-karma": "0.8.2",
12+
"grunt": "^0.4.4",
13+
"grunt-contrib-jshint": "^0.9.2",
14+
"grunt-istanbul-coverage": "^0.0.4",
15+
"grunt-karma": "^0.8.2",
1716
"karma-chrome-launcher": "^0.1.2",
18-
"karma-coverage": "0.2.1",
17+
"karma-coverage": "^0.2.1",
1918
"karma-firefox-launcher": "^0.1.3",
2019
"karma-jasmine": "^0.1.5",
21-
"karma-phantomjs-launcher": "0.1.2",
22-
"matchdep": "0.3.0",
20+
"karma-phantomjs-launcher": "^0.1.2",
21+
"matchdep": "^0.3.0",
2322
"phantomjs": "^1.9.7-1"
2423
},
2524
"peerDependencies": {

src/js/datetimepicker.js

+49-51
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*jslint vars:true */
33

44
/**
5-
* @license angular-bootstrap-datetimepicker v0.2.2
5+
* @license angular-bootstrap-datetimepicker v0.2.3
66
* (c) 2013 Knight Rider Consulting, Inc. http://www.knightrider.com
77
* License: MIT
88
*/
@@ -21,54 +21,52 @@ angular.module('ui.bootstrap.datetimepicker', [])
2121
startView: 'day',
2222
weekStart: 0
2323
})
24-
.constant('dateTimePickerConfigValidation', function (configuration) {
24+
.directive('datetimepicker', ['dateTimePickerConfig', function (defaultConfig) {
2525
"use strict";
2626

27-
var validOptions = ['startView', 'minView', 'minuteStep', 'dropdownSelector', 'weekStart'];
27+
var validateConfiguration = function (configuration) {
28+
var validOptions = ['startView', 'minView', 'minuteStep', 'dropdownSelector', 'weekStart'];
2829

29-
for (var prop in configuration) {
30-
if (configuration.hasOwnProperty(prop)) {
31-
if (validOptions.indexOf(prop) < 0) {
32-
throw ("invalid option: " + prop);
30+
for (var prop in configuration) {
31+
if (configuration.hasOwnProperty(prop)) {
32+
if (validOptions.indexOf(prop) < 0) {
33+
throw ("invalid option: " + prop);
34+
}
3335
}
3436
}
35-
}
36-
37-
// Order of the elements in the validViews array is significant.
38-
var validViews = ['minute', 'hour', 'day', 'month', 'year'];
39-
40-
if (validViews.indexOf(configuration.startView) < 0) {
41-
throw ("invalid startView value: " + configuration.startView);
42-
}
43-
44-
if (validViews.indexOf(configuration.minView) < 0) {
45-
throw ("invalid minView value: " + configuration.minView);
46-
}
47-
48-
if (validViews.indexOf(configuration.minView) > validViews.indexOf(configuration.startView)) {
49-
throw ("startView must be greater than minView");
50-
}
51-
52-
if (!angular.isNumber(configuration.minuteStep)) {
53-
throw ("minuteStep must be numeric");
54-
}
55-
if (configuration.minuteStep <= 0 || configuration.minuteStep >= 60) {
56-
throw ("minuteStep must be greater than zero and less than 60");
57-
}
58-
if (configuration.dropdownSelector !== null && !angular.isString(configuration.dropdownSelector)) {
59-
throw ("dropdownSelector must be a string");
60-
}
61-
62-
if (!angular.isNumber(configuration.weekStart)) {
63-
throw ("weekStart must be numeric");
64-
}
65-
if (configuration.weekStart < 0 || configuration.weekStart > 6) {
66-
throw ("weekStart must be greater than or equal to zero and less than 7");
67-
}
68-
}
69-
)
70-
.directive('datetimepicker', ['dateTimePickerConfig', 'dateTimePickerConfigValidation', function (defaultConfig, validateConfigurationFunction) {
71-
"use strict";
37+
38+
// Order of the elements in the validViews array is significant.
39+
var validViews = ['minute', 'hour', 'day', 'month', 'year'];
40+
41+
if (validViews.indexOf(configuration.startView) < 0) {
42+
throw ("invalid startView value: " + configuration.startView);
43+
}
44+
45+
if (validViews.indexOf(configuration.minView) < 0) {
46+
throw ("invalid minView value: " + configuration.minView);
47+
}
48+
49+
if (validViews.indexOf(configuration.minView) > validViews.indexOf(configuration.startView)) {
50+
throw ("startView must be greater than minView");
51+
}
52+
53+
if (!angular.isNumber(configuration.minuteStep)) {
54+
throw ("minuteStep must be numeric");
55+
}
56+
if (configuration.minuteStep <= 0 || configuration.minuteStep >= 60) {
57+
throw ("minuteStep must be greater than zero and less than 60");
58+
}
59+
if (configuration.dropdownSelector !== null && !angular.isString(configuration.dropdownSelector)) {
60+
throw ("dropdownSelector must be a string");
61+
}
62+
63+
if (!angular.isNumber(configuration.weekStart)) {
64+
throw ("weekStart must be numeric");
65+
}
66+
if (configuration.weekStart < 0 || configuration.weekStart > 6) {
67+
throw ("weekStart must be greater than or equal to zero and less than 7");
68+
}
69+
};
7270

7371
return {
7472
restrict: 'E',
@@ -78,31 +76,31 @@ angular.module('ui.bootstrap.datetimepicker', [])
7876
" <thead>" +
7977
" <tr>" +
8078
" <th class='left'" +
81-
" data-ng-click=\"changeView(data.currentView, data.leftDate, $event)\"" +
79+
" data-ng-click='changeView(data.currentView, data.leftDate, $event)'" +
8280
" ><i class='glyphicon glyphicon-arrow-left'/></th>" +
8381
" <th class='switch' colspan='5'" +
84-
" data-ng-click=\"changeView(data.previousView, data.currentDate, $event)\"" +
82+
" data-ng-click='changeView(data.previousView, data.currentDate, $event)'" +
8583
">{{ data.title }}</th>" +
8684
" <th class='right'" +
87-
" data-ng-click=\"changeView(data.currentView, data.rightDate, $event)\"" +
85+
" data-ng-click='changeView(data.currentView, data.rightDate, $event)'" +
8886
" ><i class='glyphicon glyphicon-arrow-right'/></th>" +
8987
" </tr>" +
9088
" <tr>" +
9189
" <th class='dow' data-ng-repeat='day in data.dayNames' >{{ day }}</th>" +
9290
" </tr>" +
9391
" </thead>" +
9492
" <tbody>" +
95-
' <tr data-ng-class=\'{ hide: data.currentView == "day" }\' >' +
93+
" <tr data-ng-class='{ hide: data.currentView == \"day\" }' >" +
9694
" <td colspan='7' >" +
9795
" <span class='{{ data.currentView }}' " +
9896
" data-ng-repeat='dateValue in data.dates' " +
9997
" data-ng-class='{active: dateValue.active, past: dateValue.past, future: dateValue.future}' " +
10098
" data-ng-click=\"changeView(data.nextView, dateValue.date, $event)\">{{ dateValue.display }}</span> " +
10199
" </td>" +
102100
" </tr>" +
103-
' <tr data-ng-show=\'data.currentView == "day"\' data-ng-repeat=\'week in data.weeks\'>' +
101+
" <tr data-ng-show='data.currentView == \"day\"' data-ng-repeat='week in data.weeks'>" +
104102
" <td data-ng-repeat='dateValue in week.dates' " +
105-
" data-ng-click=\"changeView(data.nextView, dateValue.date, $event)\"" +
103+
" data-ng-click='changeView(data.nextView, dateValue.date, $event)'" +
106104
" class='day' " +
107105
" data-ng-class='{active: dateValue.active, past: dateValue.past, future: dateValue.future}' >{{ dateValue.display }}</td>" +
108106
" </tr>" +
@@ -125,7 +123,7 @@ angular.module('ui.bootstrap.datetimepicker', [])
125123

126124
angular.extend(configuration, defaultConfig, directiveConfig);
127125

128-
validateConfigurationFunction(configuration);
126+
validateConfiguration(configuration);
129127

130128
var dataFactory = {
131129
year: function (unixDate) {

0 commit comments

Comments
 (0)