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 --- examples/disabled.html | 1 + examples/disabled.js | 36 ++++++++++++++++++++++++++++++++++++ examples/hidden.html | 1 + examples/hidden.js | 37 +++++++++++++++++++++++++++++++++++++ examples/pick-time.js | 18 +----------------- 5 files changed, 76 insertions(+), 17 deletions(-) create mode 100644 examples/disabled.html create mode 100644 examples/disabled.js create mode 100644 examples/hidden.html create mode 100644 examples/hidden.js (limited to 'examples') diff --git a/examples/disabled.html b/examples/disabled.html new file mode 100644 index 0000000..48cdce8 --- /dev/null +++ b/examples/disabled.html @@ -0,0 +1 @@ +placeholder diff --git a/examples/disabled.js b/examples/disabled.js new file mode 100644 index 0000000..24d0068 --- /dev/null +++ b/examples/disabled.js @@ -0,0 +1,36 @@ +/* eslint no-console:0 */ + +import 'rc-time-picker/assets/index.less'; + +import React from 'react'; +import ReactDom from 'react-dom'; + +import GregorianCalendar from 'gregorian-calendar'; +import DateTimeFormat from 'gregorian-calendar-format'; +import zhCn from 'gregorian-calendar/lib/locale/zh_CN'; + +import TimePicker from 'rc-time-picker'; +import TimePickerLocale from 'rc-time-picker/src/locale/zh_CN'; + +const showSecond = true; +const str = showSecond ? 'HH:mm:ss' : 'HH:mm'; + +const formatter = new DateTimeFormat(str); + +const now = new GregorianCalendar(zhCn); +now.setTime(Date.now()); + +function onChange(value) { + console.log(value && formatter.format(value)); +} + +ReactDom.render( + , + document.getElementById('__react-content') +); diff --git a/examples/hidden.html b/examples/hidden.html new file mode 100644 index 0000000..48cdce8 --- /dev/null +++ b/examples/hidden.html @@ -0,0 +1 @@ +placeholder diff --git a/examples/hidden.js b/examples/hidden.js new file mode 100644 index 0000000..1084236 --- /dev/null +++ b/examples/hidden.js @@ -0,0 +1,37 @@ +/* eslint no-console:0 */ + +import 'rc-time-picker/assets/index.less'; + +import React from 'react'; +import ReactDom from 'react-dom'; + +import GregorianCalendar from 'gregorian-calendar'; +import DateTimeFormat from 'gregorian-calendar-format'; +import zhCn from 'gregorian-calendar/lib/locale/zh_CN'; + +import TimePicker from 'rc-time-picker'; +import TimePickerLocale from 'rc-time-picker/src/locale/zh_CN'; + +const showSecond = true; +const str = showSecond ? 'HH:mm:ss' : 'HH:mm'; + +const formatter = new DateTimeFormat(str); + +const now = new GregorianCalendar(zhCn); +now.setTime(Date.now()); + +function onChange(value) { + console.log(value && formatter.format(value)); +} + +ReactDom.render( + , + document.getElementById('__react-content') +); diff --git a/examples/pick-time.js b/examples/pick-time.js index 074e72c..f66e416 100644 --- a/examples/pick-time.js +++ b/examples/pick-time.js @@ -24,27 +24,11 @@ function onChange(value) { console.log(value && formatter.format(value)); } -const options = { - disabledHours() { - return [0, 2, 21]; - }, - disabledMinutes(h) { - return h === 22 ? [0, 3, 31] : []; - }, - disabledSeconds(h, m) { - return []; - }, -}; - ReactDom.render( , + onChange={onChange} />, document.getElementById('__react-content') ); -- cgit v1.2.3