Skip to content

Commit

Permalink
chore(legacy): InputDateRange test fix (#9869)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlufy authored Dec 2, 2024
1 parent 6ea3711 commit a6a5d74
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,20 @@ describe('InputDateRangeComponent', () => {
});

describe('With items', () => {
beforeAll(() => {
jest.useFakeTimers({advanceTimers: true}).setSystemTime(
new Date('2024-01-15'),
);
});

beforeEach(() => {
testComponent.items = tuiCreateDefaultDayRangePeriods();
});

afterAll(() => {
jest.useRealTimers();
});

it('when entering item date, input shows named date', async () => {
const today = TuiDay.currentLocal();

Expand Down Expand Up @@ -250,21 +260,18 @@ describe('InputDateRangeComponent', () => {
expect(inputPO.value).toBe('Today');
});

// TODO: check what's wrong with the test https://github.com/taiga-family/taiga-ui/pull/9707
it.skip('when selected item date via calendar, input shows named date', async () => {
inputPO.sendText('');
it('when selected item date via calendar, input shows named date', async () => {
const todayDay = TuiDay.currentLocal().day;

fixture.detectChanges();
inputPO.sendText('');

const [leftCalendar] = getCalendars();

expect(leftCalendar).toBeTruthy();

if (leftCalendar) {
getCalendarCell(
leftCalendar,
TuiDay.currentLocal().day,
)?.nativeElement?.click();
getCalendarCell(leftCalendar, todayDay)?.nativeElement?.click();
getCalendarCell(leftCalendar, todayDay)?.nativeElement?.click();
}

fixture.detectChanges();
Expand Down

0 comments on commit a6a5d74

Please sign in to comment.