Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(legacy): InputDateRange test fix #9869

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading