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 {
449
449
} ) ;
450
450
451
451
this . props . onChange ( changedDate ) ;
452
- this . setOpen ( false ) ;
452
+ if ( this . props . shouldCloseOnSelect ) {
453
+ this . setOpen ( false ) ;
454
+ }
453
455
this . setState ( { inputValue : null } ) ;
454
456
} ;
455
457
Original file line number Diff line number Diff line change @@ -39,6 +39,18 @@ describe("TimePicker", () => {
39
39
expect ( getInputString ( ) ) . to . equal ( "February 28, 2018 4:43 PM" ) ;
40
40
} ) ;
41
41
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
+
42
54
function setManually ( string ) {
43
55
TestUtils . Simulate . focus ( datePicker . input ) ;
44
56
TestUtils . Simulate . change ( datePicker . input , { target : { value : string } } ) ;
You can’t perform that action at this time.
0 commit comments