@@ -151,10 +151,14 @@ describe('DatePicker', () => {
151
151
} )
152
152
153
153
it ( 'should update the preSelection state when a day is selected with mouse click' , ( ) => {
154
- var data = getOnInputKeyDownStuff ( { shouldCloseOnSelect : false } )
155
- var day = TestUtils . findRenderedDOMComponentWithClass ( data . datePicker . calendar , 'react-datepicker__day--today' )
154
+ // Note: We need monthsShown=2 so that today can still be clicked when
155
+ // ArrowLeft selects the previous month. (On the 1st 2 days of the month.)
156
+ var data = getOnInputKeyDownStuff ( { shouldCloseOnSelect : false , monthsShown : 2 } )
157
+
156
158
TestUtils . Simulate . keyDown ( data . nodeInput , { key : 'ArrowLeft' , keyCode : 37 , which : 37 } )
157
159
TestUtils . Simulate . keyDown ( data . nodeInput , { key : 'ArrowLeft' , keyCode : 37 , which : 37 } )
160
+
161
+ var day = TestUtils . findRenderedDOMComponentWithClass ( data . datePicker . calendar , 'react-datepicker__day--today' )
158
162
TestUtils . Simulate . click ( ReactDOM . findDOMNode ( day ) )
159
163
160
164
TestUtils . Simulate . keyDown ( data . nodeInput , { key : 'ArrowDown' , keyCode : 40 , which : 40 } )
@@ -322,6 +326,7 @@ describe('DatePicker', () => {
322
326
filterDate = { opts . filterDate }
323
327
minDate = { opts . minDate }
324
328
maxDate = { opts . maxDate }
329
+ monthsShown = { opts . monthsShown }
325
330
shouldCloseOnSelect = { opts . shouldCloseOnSelect } />
326
331
)
327
332
var dateInput = datePicker . input
0 commit comments