diff options
author | MG12 <wuzhao.mail@gmail.com> | 2015-12-13 00:03:19 +0800 |
---|---|---|
committer | MG12 <wuzhao.mail@gmail.com> | 2015-12-13 00:03:19 +0800 |
commit | 0e62bf0b7bdc260e882fd185492939cbaed04d56 (patch) | |
tree | 84f678a775ead7577fdcac9089ca918b4febcf39 /src/module | |
parent | 518b852e8bd9c50a6c5c7e84cddecb5c94ebb5b6 (diff) | |
download | time-picker-0e62bf0b7bdc260e882fd185492939cbaed04d56.tar.gz time-picker-0e62bf0b7bdc260e882fd185492939cbaed04d56.tar.zst time-picker-0e62bf0b7bdc260e882fd185492939cbaed04d56.zip |
update test case and fix bugs
Diffstat (limited to 'src/module')
-rw-r--r-- | src/module/Combobox.jsx | 2 | ||||
-rw-r--r-- | src/module/Header.jsx | 6 | ||||
-rw-r--r-- | src/module/Panel.jsx | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/module/Combobox.jsx b/src/module/Combobox.jsx index 27a8226..1e172a7 100644 --- a/src/module/Combobox.jsx +++ b/src/module/Combobox.jsx | |||
@@ -9,7 +9,7 @@ const formatOption = (option, disabledOptions) => { | |||
9 | } | 9 | } |
10 | 10 | ||
11 | let disabled = false; | 11 | let disabled = false; |
12 | if (disabledOptions.indexOf(option) >= 0) { | 12 | if (disabledOptions && disabledOptions.indexOf(option) >= 0) { |
13 | disabled = true; | 13 | disabled = true; |
14 | } | 14 | } |
15 | 15 | ||
diff --git a/src/module/Header.jsx b/src/module/Header.jsx index c2f8eef..fec02af 100644 --- a/src/module/Header.jsx +++ b/src/module/Header.jsx | |||
@@ -88,9 +88,9 @@ const Header = React.createClass({ | |||
88 | 88 | ||
89 | // if time value is disabled, response warning. | 89 | // if time value is disabled, response warning. |
90 | if ( | 90 | if ( |
91 | disabledHours.indexOf(value.getHourOfDay()) >= 0 || | 91 | (disabledHours && disabledHours.indexOf(value.getHourOfDay()) >= 0) || |
92 | disabledMinutes.indexOf(value.getMinutes()) >= 0 || | 92 | (disabledMinutes && disabledMinutes.indexOf(value.getMinutes()) >= 0) || |
93 | disabledSeconds.indexOf(value.getSeconds()) >= 0 | 93 | (disabledSeconds && disabledSeconds.indexOf(value.getSeconds()) >= 0) |
94 | ) { | 94 | ) { |
95 | this.setState({ | 95 | this.setState({ |
96 | invalid: true, | 96 | invalid: true, |
diff --git a/src/module/Panel.jsx b/src/module/Panel.jsx index 72934e5..12d23f7 100644 --- a/src/module/Panel.jsx +++ b/src/module/Panel.jsx | |||
@@ -9,7 +9,7 @@ function noop() { | |||
9 | function generateOptions(length, disabledOptions, hideDisabledOptions) { | 9 | function generateOptions(length, disabledOptions, hideDisabledOptions) { |
10 | const arr = []; | 10 | const arr = []; |
11 | for (let value = 0; value < length; value++) { | 11 | for (let value = 0; value < length; value++) { |
12 | if ((disabledOptions && disabledOptions.indexOf(value) < 0) || !hideDisabledOptions) { | 12 | if (!disabledOptions || disabledOptions.indexOf(value) < 0 || !hideDisabledOptions) { |
13 | arr.push(value); | 13 | arr.push(value); |
14 | } | 14 | } |
15 | } | 15 | } |