@ludo.ninja/components 2.1.13 → 2.1.15

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.
@@ -110,7 +110,7 @@ const CreationCard = ({ creationName, creation, isNeedHeight, likesDynamicInfo,
110
110
  const HideLink = isHide ? react_1.default.Fragment : link_1.default;
111
111
  const getLink = (href) => {
112
112
  if (creation.getItemType() === ItemType_1.LabelKeys.asset) {
113
- return `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["asset"]}/${href.replace(`${ItemType_1.LabelKeys.asset}/`, "")}`;
113
+ return `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["asset"]}/${href.replace(`/${ItemType_1.LabelKeys.asset}/`, "")}`;
114
114
  }
115
115
  return href;
116
116
  };
@@ -13,6 +13,7 @@ const StyledHeadIcons = styled_components_1.default.div `
13
13
  opacity: 0;
14
14
 
15
15
  &:before {
16
+ pointer-events: none;
16
17
  content: '';
17
18
  position: absolute;
18
19
  top: 0;
@@ -10,12 +10,14 @@ require("jest-styled-components");
10
10
  const store_1 = require("../../../modules/user/store");
11
11
  const index_1 = __importDefault(require("./index"));
12
12
  const useFetchUserPic_1 = __importDefault(require("../../../api/server-medias/queries/useFetchUserPic"));
13
+ const env_1 = require("../../../store/env");
13
14
  jest.mock('@/modules/user/store');
14
15
  jest.mock('@/api/server-medias/queries/useFetchUserPic');
15
16
  jest.mock('@/utils/env', () => ({
16
17
  getMediaENVDomain: jest.fn().mockReturnValue('https://media.ludo.ninja'),
17
18
  }));
18
19
  jest.mock('@/public/defaultUserpics/defaultUserpic.svg', () => 'div');
20
+ jest.mock('@/store/env');
19
21
  describe('UserPic Component', () => {
20
22
  beforeEach(() => {
21
23
  store_1.useUserStore.mockReturnValue({
@@ -23,6 +25,7 @@ describe('UserPic Component', () => {
23
25
  isLoadingProfileData: false,
24
26
  profileData: null,
25
27
  });
28
+ env_1.useEnvStore.mockReturnValue(jest.fn());
26
29
  useFetchUserPic_1.default.mockReturnValue({
27
30
  load: jest.fn(),
28
31
  userPic: 'fetched-user-pic.svg',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.1.13",
3
+ "version": "2.1.15",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -17,6 +17,8 @@
17
17
  "check-format": "prettier --check .",
18
18
  "check-lint": "eslint . --ext ts --ext tsx --ext js",
19
19
  "lint": "npm run check-format && npm run check-lint && npm run check-types && npm run test && npm run build",
20
+ "test": "jest",
21
+ "test:watch": "jest --watch",
20
22
  "build": "npm run check-types && npm run build:tsc && npm run svgPublic && npm run replaceImports",
21
23
  "publish": "npm publish --access public -workspace @ludo.ninja/components"
22
24
  },
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom/extend-expect';
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- require("@testing-library/jest-dom/extend-expect");
8
- const react_1 = require("@testing-library/react");
9
- const index_1 = __importDefault(require("./index"));
10
- const getCheckbox = () => react_1.screen.getByTestId('container')?.children[0].querySelector('input');
11
- describe('CardCheckBox Component', () => {
12
- const handleChange = jest.fn();
13
- const renderComponent = (isActiveCheckbox = false) => {
14
- return (0, react_1.render)((0, jsx_runtime_1.jsx)("div", { "data-testid": 'container', children: (0, jsx_runtime_1.jsx)(index_1.default, { isActiveCheckbox: isActiveCheckbox, onChange: handleChange }) }));
15
- };
16
- test('renders the checkbox correctly', () => {
17
- renderComponent(false);
18
- const checkbox = getCheckbox();
19
- expect(checkbox).toBeInTheDocument();
20
- expect(checkbox).not.toBeChecked();
21
- });
22
- test('checkbox toggles state on click', () => {
23
- const { rerender } = renderComponent(false);
24
- const checkbox = getCheckbox();
25
- expect(checkbox).not.toBeChecked();
26
- rerender((0, jsx_runtime_1.jsx)("div", { "data-testid": 'container', children: (0, jsx_runtime_1.jsx)(index_1.default, { isActiveCheckbox: true, onChange: handleChange }) }));
27
- expect(checkbox).toBeChecked();
28
- });
29
- test('calls onChange callback when clicked', () => {
30
- renderComponent(false);
31
- const checkbox = getCheckbox();
32
- react_1.fireEvent.click(checkbox);
33
- expect(handleChange).toHaveBeenCalledTimes(1);
34
- });
35
- });