Skip to content

Commit 45a2f5d

Browse files
committed
tests(days-view): Use different way to override formatterDay, since its getter only now.
1 parent ded800a commit 45a2f5d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

projects/igniteui-angular/calendar/src/calendar/days-view/days-view.component.spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,13 @@ describe("Days View Component", () => {
127127

128128
// Mock the formatter behavior
129129
// Simulate a locale (like zh-CN) that adds a suffix to the day number.
130-
// Cast to 'any' to overwrite the protected 'formatterDay' property used by formattedDate()
131-
(daysView as any).formatterDay = {
132-
format: () => '25日',
133-
} as Intl.DateTimeFormat;
130+
Object.defineProperty(daysView, "formatterDay", {
131+
get() {
132+
return {
133+
format: () => '25日',
134+
} as Intl.DateTimeFormat
135+
}
136+
});
134137

135138
// 1. Verify Programmatic Access (formattedDate method)
136139
// Should return the raw formatted string from the formatter (with suffix)

0 commit comments

Comments
 (0)