Skip to content

Commit 607fd60

Browse files
Fix test
1 parent cf8640b commit 607fd60

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

src/calendar.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -909,11 +909,6 @@ export default class Calendar extends Component<CalendarProps, CalendarState> {
909909
this.props,
910910
);
911911

912-
const showDayNames =
913-
!this.props.showMonthYearPicker &&
914-
!this.props.showQuarterYearPicker &&
915-
!this.props.showYearPicker;
916-
917912
return (
918913
<div
919914
className="react-datepicker__header react-datepicker__header--custom"
@@ -935,11 +930,6 @@ export default class Calendar extends Component<CalendarProps, CalendarState> {
935930
prevYearButtonDisabled,
936931
nextYearButtonDisabled,
937932
})}
938-
{showDayNames && (
939-
<div className="react-datepicker__day-names">
940-
{this.header(monthDate)}
941-
</div>
942-
)}
943933
</div>
944934
);
945935
};

src/month.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,10 +1124,7 @@ export default class Month extends Component<MonthProps> {
11241124

11251125
// For regular calendar view, use table structure
11261126
return (
1127-
<div
1128-
role="table"
1129-
aria-label={`${formattedAriaLabelPrefix}${formatDate(day, "MMMM, yyyy", this.props.locale)}`}
1130-
>
1127+
<div role="table">
11311128
{this.props.dayNamesHeader && (
11321129
<div role="rowgroup">{this.props.dayNamesHeader}</div>
11331130
)}
@@ -1139,6 +1136,7 @@ export default class Month extends Component<MonthProps> {
11391136
onPointerLeave={
11401137
this.props.usePointerEvent ? this.handleMouseLeave : undefined
11411138
}
1139+
aria-label={`${formattedAriaLabelPrefix}${formatDate(day, "MMMM, yyyy", this.props.locale)}`}
11421140
role="rowgroup"
11431141
>
11441142
{this.renderWeeks()}

src/test/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,28 @@ import "jest-canvas-mock";
22
import { toHaveNoViolations } from "jest-axe";
33

44
expect.extend(toHaveNoViolations);
5+
6+
// Suppress act() warnings from floating-ui library
7+
const originalError = console.error;
8+
beforeAll(() => {
9+
console.error = (...args) => {
10+
// Check if any of the arguments contains the floating-ui act warning
11+
const hasFloatingActWarning = args.some(
12+
(arg) =>
13+
typeof arg === "string" &&
14+
arg.includes(
15+
"An update to withFloating(PopperComponent) inside a test was not wrapped in act",
16+
),
17+
);
18+
19+
if (hasFloatingActWarning) {
20+
return;
21+
}
22+
23+
originalError.call(console, ...args);
24+
};
25+
});
26+
27+
afterAll(() => {
28+
console.error = originalError;
29+
});

0 commit comments

Comments
 (0)