-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix #5485: Messages restore close animation * Fix #5490: useDebounce fixed * Fix #5492: Listbox passthrough fixes * Fix #5493: Multiselect passthrough fixes * Fix #5485: Messages restore close animation * Fix #5499: Autocomplete/Chips PT fixes * Fix #5479: CascadeSelect PT fixes * Fix #5509: Button loadingIcon Tailwind fix * Fix #5512: Dropdown add tabindex for Tailwind * Support roundingMode for InputNumber * Fix #5523: BlockUI return activeElement focus * Fix #5530: Chip onRemove event pass value * DataTable:converted to data- lookups instead of className lookups * Fix #5543: OverlayPanel Tailwind close icon * Fix #5546: prop type error in console * Fix #5555: BodyCell frozen issue * Fix #5561: Inplace respect active prop * Fix #5568: MultiSelect filterInput PT * Fix #5572: Multselect selectAllLabel was being added to DOM * Tooltip fix Tailwind CSS * Dialog Breakpoints * Calendar disabled date handling * Fix #5609: ToggleButton focusedState * Fix #5610: Radio/Checkbox always fire onClick * fix: #5613, TreeSelect: TreeSelect component is not supporting tooltips and is an issue in multiple select mode * Fix #5623 - Otherprops not working for InputSwitch * fix:Calendar not showing correctly in Table * fix:Image preview zoom in bug * Fix #5637: Sidebar aria-label close * Accept array as PT value * Datatable breakpoints * fix:ConfirmDialog: acceptButton's pt don't respect button
- Loading branch information
Showing
41 changed files
with
527 additions
and
212 deletions.
There are no files selected for viewing
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
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,93 @@ | ||
import '@testing-library/jest-dom'; | ||
import { render } from '@testing-library/react'; | ||
import { PrimeReactProvider } from '../api/Api'; | ||
import { Calendar } from './Calendar'; | ||
|
||
describe('Calendar', () => { | ||
function getAllDatesOfYear(year) { | ||
let startDate = new Date(year, 0, 1); | ||
let endDate = new Date(year, 11, 31); | ||
|
||
let dates = []; | ||
let currentDate = startDate; | ||
|
||
while (currentDate <= endDate) { | ||
dates.push(new Date(currentDate)); | ||
currentDate.setDate(currentDate.getDate() + 1); | ||
} | ||
|
||
return dates; | ||
} | ||
|
||
test('When the days of the year are disabled, then the years and month should be disabled', async () => { | ||
const { container } = render( | ||
<PrimeReactProvider> | ||
<Calendar value={new Date(2023, 11, 15)} inline view="year" disabledDates={getAllDatesOfYear(2023)} /> | ||
</PrimeReactProvider> | ||
); | ||
|
||
const years = container.querySelectorAll('.p-yearpicker-year'); | ||
|
||
for (const year of years) { | ||
if (year.innerHTML === '2023') { | ||
expect(year).toHaveAttribute('data-p-disabled', 'true'); | ||
expect(year).toHaveClass('p-disabled'); | ||
} else { | ||
expect(year).toHaveAttribute('data-p-disabled', 'false'); | ||
expect(year).not.toHaveClass('p-disabled'); | ||
} | ||
} | ||
|
||
const { container: monthContainer } = render( | ||
<PrimeReactProvider> | ||
<Calendar value={new Date(2023, 11, 15)} inline view="month" disabledDates={getAllDatesOfYear(2023)} /> | ||
</PrimeReactProvider> | ||
); | ||
|
||
const months = monthContainer.querySelectorAll('.p-monthpicker-month'); | ||
|
||
for (const month of months) { | ||
expect(month).toHaveAttribute('data-p-disabled', 'true'); | ||
expect(month).toHaveClass('p-disabled'); | ||
} | ||
}); | ||
|
||
test('If any day of the month is not disabled, then both the year and month can be selected', async () => { | ||
const disabledDates = getAllDatesOfYear(2023); | ||
|
||
// January and December are not disabled. | ||
disabledDates.shift(); | ||
disabledDates.pop(); | ||
|
||
const { container: yearContainer } = render( | ||
<PrimeReactProvider> | ||
<Calendar value={new Date(2023, 11, 15)} inline view="year" disabledDates={disabledDates} /> | ||
</PrimeReactProvider> | ||
); | ||
const years = yearContainer.querySelectorAll('.p-yearpicker-year'); | ||
|
||
for (const year of years) { | ||
expect(year).toHaveAttribute('data-p-disabled', 'false'); | ||
expect(year).not.toHaveClass('p-disabled'); | ||
} | ||
|
||
// month | ||
const { container: monthContainer } = render( | ||
<PrimeReactProvider> | ||
<Calendar value={new Date(2023, 11, 15)} inline view="month" disabledDates={disabledDates} /> | ||
</PrimeReactProvider> | ||
); | ||
|
||
const months = monthContainer.querySelectorAll('.p-monthpicker-month'); | ||
|
||
Array.from(months).forEach((month, index) => { | ||
if (index === 0 || index === 11) { | ||
expect(month).toHaveAttribute('data-p-disabled', 'false'); | ||
expect(month).not.toHaveClass('p-disabled'); | ||
} else { | ||
expect(month).toHaveAttribute('data-p-disabled', 'true'); | ||
expect(month).toHaveClass('p-disabled'); | ||
} | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.