From 0e62bf0b7bdc260e882fd185492939cbaed04d56 Mon Sep 17 00:00:00 2001 From: MG12 Date: Sun, 13 Dec 2015 00:03:19 +0800 Subject: update test case and fix bugs --- src/module/Combobox.jsx | 2 +- src/module/Header.jsx | 6 +++--- src/module/Panel.jsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') 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) => { } let disabled = false; - if (disabledOptions.indexOf(option) >= 0) { + if (disabledOptions && disabledOptions.indexOf(option) >= 0) { disabled = true; } 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({ // if time value is disabled, response warning. if ( - disabledHours.indexOf(value.getHourOfDay()) >= 0 || - disabledMinutes.indexOf(value.getMinutes()) >= 0 || - disabledSeconds.indexOf(value.getSeconds()) >= 0 + (disabledHours && disabledHours.indexOf(value.getHourOfDay()) >= 0) || + (disabledMinutes && disabledMinutes.indexOf(value.getMinutes()) >= 0) || + (disabledSeconds && disabledSeconds.indexOf(value.getSeconds()) >= 0) ) { this.setState({ 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() { function generateOptions(length, disabledOptions, hideDisabledOptions) { const arr = []; for (let value = 0; value < length; value++) { - if ((disabledOptions && disabledOptions.indexOf(value) < 0) || !hideDisabledOptions) { + if (!disabledOptions || disabledOptions.indexOf(value) < 0 || !hideDisabledOptions) { arr.push(value); } } -- cgit v1.2.3