@astral/ui 1.42.0 → 1.43.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.
- package/Button/Button.test.js +10 -9
- package/DataGrid/DataGrid.test.js +2 -1
- package/esm/Button/Button.test.js +1 -0
- package/esm/DataGrid/DataGrid.test.js +2 -1
- package/esm/hooks/useEscapeClickEffect/useEscapeClickEffect.test.js +3 -2
- package/hooks/useEscapeClickEffect/useEscapeClickEffect.test.js +3 -2
- package/package.json +2 -2
package/Button/Button.test.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const tests_1 = require("@astral/tests");
|
|
5
|
+
const vitest_1 = require("vitest");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const Button_1 = require("./Button");
|
|
7
|
-
describe('Button', () => {
|
|
8
|
-
it('Prop:ref: is present', () => {
|
|
8
|
+
(0, vitest_1.describe)('Button', () => {
|
|
9
|
+
(0, vitest_1.it)('Prop:ref: is present', () => {
|
|
9
10
|
const resultRef = { current: null };
|
|
10
11
|
const ButtonWithRef = () => {
|
|
11
12
|
const ref = (0, react_1.useRef)(null);
|
|
@@ -15,21 +16,21 @@ describe('Button', () => {
|
|
|
15
16
|
return (0, jsx_runtime_1.jsx)(Button_1.Button, Object.assign({ ref: ref }, { children: "Btn" }));
|
|
16
17
|
};
|
|
17
18
|
(0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(ButtonWithRef, {}));
|
|
18
|
-
expect(resultRef === null || resultRef === void 0 ? void 0 : resultRef.current).not.toBeNull();
|
|
19
|
+
(0, vitest_1.expect)(resultRef === null || resultRef === void 0 ? void 0 : resultRef.current).not.toBeNull();
|
|
19
20
|
});
|
|
20
|
-
it('Prop:disabled: блокирует кнопку', () => {
|
|
21
|
+
(0, vitest_1.it)('Prop:disabled: блокирует кнопку', () => {
|
|
21
22
|
(0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(Button_1.Button, Object.assign({ disabled: true }, { children: "Btn" })));
|
|
22
23
|
const button = tests_1.screen.getByRole('button');
|
|
23
|
-
expect(button).toBeDisabled();
|
|
24
|
+
(0, vitest_1.expect)(button).toBeDisabled();
|
|
24
25
|
});
|
|
25
|
-
it('Prop:loading: блокирует кнопку', () => {
|
|
26
|
+
(0, vitest_1.it)('Prop:loading: блокирует кнопку', () => {
|
|
26
27
|
(0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(Button_1.Button, Object.assign({ loading: true }, { children: "Btn" })));
|
|
27
28
|
const button = tests_1.screen.getByRole('button');
|
|
28
|
-
expect(button).toBeDisabled();
|
|
29
|
+
(0, vitest_1.expect)(button).toBeDisabled();
|
|
29
30
|
});
|
|
30
|
-
it('Prop:loading: отображается лоадер', () => {
|
|
31
|
+
(0, vitest_1.it)('Prop:loading: отображается лоадер', () => {
|
|
31
32
|
(0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(Button_1.Button, Object.assign({ loading: true }, { children: "Btn" })));
|
|
32
33
|
const loader = tests_1.screen.getByRole('progressbar');
|
|
33
|
-
expect(loader).toBeVisible();
|
|
34
|
+
(0, vitest_1.expect)(loader).toBeVisible();
|
|
34
35
|
});
|
|
35
36
|
});
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
13
13
|
const tests_1 = require("@astral/tests");
|
|
14
14
|
const react_1 = require("react");
|
|
15
|
+
const vitest_1 = require("vitest");
|
|
15
16
|
const DataGrid_1 = require("./DataGrid");
|
|
16
17
|
describe('DataGrid', () => {
|
|
17
18
|
it('Props:columns: отображаются названия колонок', () => {
|
|
@@ -85,7 +86,7 @@ describe('DataGrid', () => {
|
|
|
85
86
|
expect(title).toBeVisible();
|
|
86
87
|
}));
|
|
87
88
|
it('Props:onRowClick: по клику на строку получаем данные row', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
-
const onRowClick =
|
|
89
|
+
const onRowClick = vitest_1.vi.fn();
|
|
89
90
|
(0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(DataGrid_1.DataGrid, { keyId: "name", rows: [{ name: 'Vasya' }], onRowClick: onRowClick, columns: [
|
|
90
91
|
{
|
|
91
92
|
field: 'name',
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { renderWithTheme, screen, userEvents } from '@astral/tests';
|
|
12
12
|
import { useState } from 'react';
|
|
13
|
+
import { vi } from 'vitest';
|
|
13
14
|
import { DataGrid } from './DataGrid';
|
|
14
15
|
describe('DataGrid', () => {
|
|
15
16
|
it('Props:columns: отображаются названия колонок', () => {
|
|
@@ -83,7 +84,7 @@ describe('DataGrid', () => {
|
|
|
83
84
|
expect(title).toBeVisible();
|
|
84
85
|
}));
|
|
85
86
|
it('Props:onRowClick: по клику на строку получаем данные row', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
-
const onRowClick =
|
|
87
|
+
const onRowClick = vi.fn();
|
|
87
88
|
renderWithTheme(_jsx(DataGrid, { keyId: "name", rows: [{ name: 'Vasya' }], onRowClick: onRowClick, columns: [
|
|
88
89
|
{
|
|
89
90
|
field: 'name',
|
|
@@ -8,16 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { renderHook, userEvents } from '@astral/tests';
|
|
11
|
+
import { vi } from 'vitest';
|
|
11
12
|
import { useEscapeClickEffect } from './useEscapeClickEffect';
|
|
12
13
|
describe('useEscapeClickEffect', () => {
|
|
13
14
|
it('Props:isActive=true: при нажатии esc вызывается onEscape', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
const onEscape =
|
|
15
|
+
const onEscape = vi.fn();
|
|
15
16
|
renderHook(() => useEscapeClickEffect({ isActive: true, onEscape }));
|
|
16
17
|
yield userEvents.keyboard('{Escape}');
|
|
17
18
|
expect(onEscape).toBeCalled();
|
|
18
19
|
}));
|
|
19
20
|
it('Props:isActive=false: при нажатии esc onEscape не вызывается', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
const onEscape =
|
|
21
|
+
const onEscape = vi.fn();
|
|
21
22
|
renderHook(() => useEscapeClickEffect({ isActive: false, onEscape }));
|
|
22
23
|
yield userEvents.keyboard('{Escape}');
|
|
23
24
|
expect(onEscape).not.toBeCalled();
|
|
@@ -10,16 +10,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const tests_1 = require("@astral/tests");
|
|
13
|
+
const vitest_1 = require("vitest");
|
|
13
14
|
const useEscapeClickEffect_1 = require("./useEscapeClickEffect");
|
|
14
15
|
describe('useEscapeClickEffect', () => {
|
|
15
16
|
it('Props:isActive=true: при нажатии esc вызывается onEscape', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
const onEscape =
|
|
17
|
+
const onEscape = vitest_1.vi.fn();
|
|
17
18
|
(0, tests_1.renderHook)(() => (0, useEscapeClickEffect_1.useEscapeClickEffect)({ isActive: true, onEscape }));
|
|
18
19
|
yield tests_1.userEvents.keyboard('{Escape}');
|
|
19
20
|
expect(onEscape).toBeCalled();
|
|
20
21
|
}));
|
|
21
22
|
it('Props:isActive=false: при нажатии esc onEscape не вызывается', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
const onEscape =
|
|
23
|
+
const onEscape = vitest_1.vi.fn();
|
|
23
24
|
(0, tests_1.renderHook)(() => (0, useEscapeClickEffect_1.useEscapeClickEffect)({ isActive: false, onEscape }));
|
|
24
25
|
yield tests_1.userEvents.keyboard('{Escape}');
|
|
25
26
|
expect(onEscape).not.toBeCalled();
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astral/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.1",
|
|
4
4
|
"browser": "./esm/index.js",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@astral/icons": "^1.
|
|
7
|
+
"@astral/icons": "^1.43.1",
|
|
8
8
|
"@emotion/cache": "11.7.1",
|
|
9
9
|
"@emotion/react": "11.9.0",
|
|
10
10
|
"@emotion/server": "11.4.0",
|