-
-
Notifications
You must be signed in to change notification settings - Fork 731
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Dan Kelly <dkelly@neat.com> Co-authored-by: gpbl <io@gpbl.dev>
- Loading branch information
1 parent
2f50a6d
commit 9991023
Showing
8 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React, { useState } from 'react'; | ||
|
||
import { DateRange, DayPicker } from 'react-day-picker'; | ||
|
||
/** | ||
* Test case for issue #1567 | ||
* | ||
* @see https://github.com/gpbl/react-day-picker/issues/1567 | ||
*/ | ||
export default function App() { | ||
const [selected, setSelected] = useState<DateRange>({ | ||
from: new Date(2022, 8, 25), | ||
to: new Date(2022, 9, 1) | ||
}); | ||
|
||
return ( | ||
<div className="App"> | ||
<DayPicker | ||
mode="range" | ||
defaultMonth={new Date(2022, 8)} | ||
onSelect={setSelected} | ||
numberOfMonths={2} | ||
showOutsideDays | ||
selected={selected} | ||
fromDate={new Date(2020, 5)} | ||
/> | ||
<button>I should be focusable</button> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
|
||
import { render, screen } from '@testing-library/react'; | ||
|
||
import { pressTab } from 'react-day-picker/test/actions'; | ||
|
||
import Example from '@examples/testcase-1567'; | ||
|
||
beforeEach(() => { | ||
render(<Example />); | ||
pressTab(); | ||
pressTab(); | ||
pressTab(); | ||
pressTab(); | ||
}); | ||
|
||
test('the button should have focus', () => { | ||
expect( | ||
screen.getByRole('button', { name: 'I should be focusable' }) | ||
).toHaveFocus(); | ||
}); |