File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -449,7 +449,9 @@ export default class DatePicker extends React.Component {
449449 } ) ;
450450
451451 this . props . onChange ( changedDate ) ;
452- this . setOpen ( false ) ;
452+ if ( this . props . shouldCloseOnSelect ) {
453+ this . setOpen ( false ) ;
454+ }
453455 this . setState ( { inputValue : null } ) ;
454456 } ;
455457
Original file line number Diff line number Diff line change @@ -39,6 +39,18 @@ describe("TimePicker", () => {
3939 expect ( getInputString ( ) ) . to . equal ( "February 28, 2018 4:43 PM" ) ;
4040 } ) ;
4141
42+ it ( "should not close datepicker after time clicked when shouldCloseOnSelect is false" , ( ) => {
43+ var datePicker = TestUtils . renderIntoDocument (
44+ < DatePicker shouldCloseOnSelect = { false } showTimeSelect />
45+ ) ;
46+ var dateInput = datePicker . input ;
47+ TestUtils . Simulate . focus ( ReactDOM . findDOMNode ( dateInput ) ) ;
48+ const time = TestUtils . findRenderedComponentWithType ( datePicker , Time ) ;
49+ const lis = TestUtils . scryRenderedDOMComponentsWithTag ( time , "li" ) ;
50+ TestUtils . Simulate . click ( lis [ 0 ] ) ;
51+ expect ( datePicker . state . open ) . to . be . true ;
52+ } ) ;
53+
4254 function setManually ( string ) {
4355 TestUtils . Simulate . focus ( datePicker . input ) ;
4456 TestUtils . Simulate . change ( datePicker . input , { target : { value : string } } ) ;
You can’t perform that action at this time.
0 commit comments