@astral/ui 1.46.0 → 1.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,18 +16,19 @@ const react_1 = require("react");
16
16
  const DatePicker_1 = require("./DatePicker");
17
17
  // Протестировать любые кейсы, связанные с MaskFiled невозможно из-за того, что MaskField использует методы, не эмулируемые в rtl
18
18
  describe('DatePicker', () => {
19
- beforeEach(() => {
20
- vitest_1.vi.useFakeTimers();
19
+ beforeAll(() => {
20
+ vitest_1.vi.useFakeTimers({ toFake: ['Date'] });
21
21
  vitest_1.vi.setSystemTime(new Date('2022-02-10'));
22
22
  });
23
- afterEach(() => {
23
+ afterAll(() => {
24
24
  vitest_1.vi.useRealTimers();
25
25
  });
26
26
  it('Props:onChange: при выборе даты в пикере в onChange передается объект Date', () => __awaiter(void 0, void 0, void 0, function* () {
27
27
  const onChange = vitest_1.vi.fn();
28
28
  (0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(DatePicker_1.DatePicker, { onChange: onChange }));
29
29
  tests_1.fireEvent.focus(tests_1.screen.getByRole('textbox'));
30
- yield (0, tests_1.act)(() => tests_1.screen.getAllByText('10')[0].click());
30
+ const dateBtn = tests_1.screen.getAllByText('10')[0];
31
+ yield tests_1.userEvents.click(dateBtn);
31
32
  expect(onChange.mock.calls[0][0] instanceof Date).toBeTruthy();
32
33
  expect(onChange.mock.calls[0][0].toISOString()).toBe('2022-02-10T00:00:00.000Z');
33
34
  }));
@@ -8,24 +8,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
- import { act, fireEvent, renderWithTheme, screen } from '@astral/tests';
11
+ import { act, fireEvent, renderWithTheme, screen, userEvents, } from '@astral/tests';
12
12
  import { vi } from 'vitest';
13
13
  import { useState } from 'react';
14
14
  import { DatePicker } from './DatePicker';
15
15
  // Протестировать любые кейсы, связанные с MaskFiled невозможно из-за того, что MaskField использует методы, не эмулируемые в rtl
16
16
  describe('DatePicker', () => {
17
- beforeEach(() => {
18
- vi.useFakeTimers();
17
+ beforeAll(() => {
18
+ vi.useFakeTimers({ toFake: ['Date'] });
19
19
  vi.setSystemTime(new Date('2022-02-10'));
20
20
  });
21
- afterEach(() => {
21
+ afterAll(() => {
22
22
  vi.useRealTimers();
23
23
  });
24
24
  it('Props:onChange: при выборе даты в пикере в onChange передается объект Date', () => __awaiter(void 0, void 0, void 0, function* () {
25
25
  const onChange = vi.fn();
26
26
  renderWithTheme(_jsx(DatePicker, { onChange: onChange }));
27
27
  fireEvent.focus(screen.getByRole('textbox'));
28
- yield act(() => screen.getAllByText('10')[0].click());
28
+ const dateBtn = screen.getAllByText('10')[0];
29
+ yield userEvents.click(dateBtn);
29
30
  expect(onChange.mock.calls[0][0] instanceof Date).toBeTruthy();
30
31
  expect(onChange.mock.calls[0][0].toISOString()).toBe('2022-02-10T00:00:00.000Z');
31
32
  }));
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "1.46.0",
3
+ "version": "1.47.1",
4
4
  "browser": "./esm/index.js",
5
5
  "main": "./index.js",
6
6
  "dependencies": {
7
- "@astral/icons": "^1.46.0",
7
+ "@astral/icons": "^1.47.1",
8
8
  "@emotion/cache": "11.7.1",
9
9
  "@emotion/react": "11.9.0",
10
10
  "@emotion/server": "11.4.0",