@woosmap/ui 3.188.0 → 3.189.0

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.
Files changed (27) hide show
  1. package/.storybook/main.js +16 -13
  2. package/package.json +40 -39
  3. package/src/components/CopyClipboardButton/CopyToClipboard.test.js +4 -5
  4. package/src/components/Demo/GeolocationDemo.js +1 -0
  5. package/src/components/Demo/LocalitiesAllDemo.js +1 -0
  6. package/src/components/Demo/LocalitiesDemo.js +1 -0
  7. package/src/components/Demo/LocalitiesFRAddressDemo.js +1 -1
  8. package/src/components/Demo/LocalitiesUKAddressDemo.js +1 -1
  9. package/src/components/Demo/MapDemo.js +1 -1
  10. package/src/components/Demo/MerchantDemo.js +1 -0
  11. package/src/components/Dropdown/Dropdown.test.js +1 -2
  12. package/src/components/DynamicTag/DynamicTag.stories.js +4 -0
  13. package/src/components/DynamicTag/DynamicTag.test.js +8 -8
  14. package/src/components/InfoMessage/InfoMessage.stories.js +1 -0
  15. package/src/components/InfoMessage/InfoMessage.test.js +2 -3
  16. package/src/components/Modal/Modal.test.js +2 -3
  17. package/src/components/Panel/Panel.js +1 -0
  18. package/src/components/PasswordStrengthBar/PasswordStrengthBar.js +21 -19
  19. package/src/components/PasswordStrengthBar/PasswordStrengthBar.stories.js +4 -0
  20. package/src/components/PasswordStrengthBar/PasswordStrengthBar.test.js +0 -7
  21. package/src/components/Select/Select.js +1 -0
  22. package/src/components/SnackBar/SnackBar.test.js +6 -6
  23. package/src/components/Switch/Switch.test.js +1 -2
  24. package/src/components/Tab/Tab.stories.js +1 -0
  25. package/src/components/Tab/Tab.test.js +3 -4
  26. package/src/components/withClickOutside/withClickOutside.test.js +3 -4
  27. package/src/components/withFormValidation/withFormValidation.test.js +4 -5
@@ -30,19 +30,19 @@ const getStylusLoader = (cssOptions) => {
30
30
  },
31
31
  {
32
32
  loader: require.resolve('postcss-loader'),
33
- options: {
34
- ident: 'postcss',
35
- plugins: () => [
36
- require('postcss-flexbugs-fixes'),
37
- require('postcss-preset-env')({
38
- autoprefixer: {
39
- flexbox: 'no-2009',
40
- },
41
- stage: 3,
42
- }),
43
- ],
44
- sourceMap: shouldUseSourceMap,
45
- },
33
+ // options: {
34
+ // ident: 'postcss',
35
+ // plugins: () => [
36
+ // require('postcss-flexbugs-fixes'),
37
+ // require('postcss-preset-env')({
38
+ // autoprefixer: {
39
+ // flexbox: 'no-2009',
40
+ // },
41
+ // stage: 3,
42
+ // }),
43
+ // ],
44
+ //sourceMap: shouldUseSourceMap,
45
+ // },
46
46
  },
47
47
  {
48
48
  loader: require.resolve('stylus-loader'),
@@ -57,6 +57,9 @@ const getStylusLoader = (cssOptions) => {
57
57
 
58
58
  // Export a function. Accept the base config as the only param.
59
59
  module.exports = {
60
+ core: {
61
+ builder: 'webpack5',
62
+ },
60
63
  stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
61
64
  addons: [
62
65
  '@storybook/addon-links',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "3.188.0",
3
+ "version": "3.189.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -9,25 +9,25 @@
9
9
  "exports": {
10
10
  ".": "./src/index.js",
11
11
  "./src/website": "./src/website.js",
12
- "./src/styles/style-website.styl": "./src/styles/style-website.styl",
13
- "./src/styles/style-console.styl": "./src/styles/style-console.styl"
12
+ "./src/styles/style-website.styl": "./src/styles/style-website.styl"
14
13
  },
15
14
  "dependencies": {
16
15
  "@mapbox/polyline": "^1.1.1",
16
+ "@storybook/manager-webpack5": "^6.5.15",
17
17
  "axios": "^0.21.1",
18
- "classnames": "^2.3.1",
19
- "framer-motion": "^4.1.17",
20
- "google-map-react": "^2.1.10",
21
- "i18next": "^20.3.5",
22
- "moment": "^2.29.1",
23
- "perfect-scrollbar": "^1.5.2",
24
- "prop-types": "^15.7.2",
25
- "react": "^17.0.2",
26
- "react-datetime": "^3.0.4",
27
- "react-dom": "^17.0.2",
28
- "react-laag": "^2.0.3",
29
- "react-select": "^4.3.1",
30
- "react-syntax-highlighter": "^15.4.4",
18
+ "classnames": "^2.3.2",
19
+ "framer-motion": "^8.1.9",
20
+ "google-map-react": "^2.2.0",
21
+ "i18next": "^22.4.8",
22
+ "moment": "^2.29.4",
23
+ "perfect-scrollbar": "^1.5.5",
24
+ "prop-types": "^15.8.1",
25
+ "react": "^18.2.0",
26
+ "react-datetime": "^3.2.0",
27
+ "react-dom": "^18.2.0",
28
+ "react-laag": "^2.0.4",
29
+ "react-select": "^5.7.0",
30
+ "react-syntax-highlighter": "^15.5.0",
31
31
  "resize-observer-polyfill": "^1.5.1",
32
32
  "zxcvbn": "^4.4.2"
33
33
  },
@@ -66,33 +66,34 @@
66
66
  ]
67
67
  },
68
68
  "devDependencies": {
69
- "@babel/cli": "^7.14.8",
70
- "@babel/core": "^7.14.8",
71
- "@babel/plugin-proposal-class-properties": "^7.14.5",
72
- "@storybook/addon-actions": "^6.3.6",
73
- "@storybook/addon-essentials": "^6.3.6",
74
- "@storybook/addon-jest": "^6.3.6",
75
- "@storybook/addon-links": "^6.3.6",
76
- "@storybook/node-logger": "^6.3.6",
77
- "@storybook/preset-create-react-app": "^3.2.0",
78
- "@storybook/react": "^6.3.6",
79
- "@storybook/storybook-deployer": "^2.8.10",
80
- "@testing-library/jest-dom": "^5.14.1",
81
- "@testing-library/react": "^11.2.7",
82
- "@testing-library/user-event": "^12.8.3",
83
- "babel-plugin-i18next-extract": "^0.8.3",
69
+ "@babel/cli": "^7.20.7",
70
+ "@babel/core": "^7.20.7",
71
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
72
+ "@storybook/addon-actions": "^6.5.15",
73
+ "@storybook/addon-essentials": "^6.5.15",
74
+ "@storybook/addon-jest": "^6.5.15",
75
+ "@storybook/addon-links": "^6.5.15",
76
+ "@storybook/builder-webpack5": "^6.5.15",
77
+ "@storybook/node-logger": "^6.5.15",
78
+ "@storybook/preset-create-react-app": "^4.1.2",
79
+ "@storybook/react": "^6.5.15",
80
+ "@storybook/storybook-deployer": "^2.8.16",
81
+ "@testing-library/jest-dom": "^5.16.5",
82
+ "@testing-library/react": "^13.4.0",
83
+ "@testing-library/user-event": "^14.4.3",
84
+ "babel-plugin-i18next-extract": "^0.9.0",
84
85
  "babel-plugin-transform-dynamic-import": "^2.1.0",
85
86
  "concurrently": "^6.2.0",
86
87
  "eslint-config-airbnb": "^18.2.1",
87
- "eslint-config-prettier": "^8.3.0",
88
- "eslint-plugin-prettier": "^3.4.0",
89
- "eslint-plugin-sonarjs": "^0.9.1",
88
+ "eslint-config-prettier": "^8.6.0",
89
+ "eslint-plugin-prettier": "^4.2.1",
90
+ "eslint-plugin-sonarjs": "^0.17.0",
90
91
  "jest-google-maps-mock": "^1.0.7",
91
- "prettier": "^2.3.2",
92
- "react-scripts": "4.0.3",
92
+ "prettier": "^2.8.1",
93
+ "react-scripts": "5.0.1",
93
94
  "rimraf": "^3.0.2",
94
- "stylus": "^0.54.8",
95
- "stylus-loader": "^4.3.3",
96
- "svgo": "^2.3.1"
95
+ "stylus": "^0.59.0",
96
+ "stylus-loader": "^7.1.0",
97
+ "svgo": "^3.0.2"
97
98
  }
98
99
  }
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
2
+ import { fireEvent, render } from '@testing-library/react';
4
3
  import '@testing-library/jest-dom/extend-expect';
5
4
 
6
5
  import CopyClipboardButton from './CopyClipboardButton';
@@ -18,20 +17,20 @@ it('renders a CopyClipboardButton component without label', () => {
18
17
  it('copies the content', () => {
19
18
  const { container } = render(<CopyClipboardButton text="Text to be copied" />);
20
19
  document.execCommand = jest.fn();
21
- userEvent.click(container.firstChild);
20
+ fireEvent.click(container.firstChild);
22
21
  expect(document.execCommand).toHaveBeenCalledWith('copy');
23
22
  });
24
23
 
25
24
  it('copies the content from callback', () => {
26
25
  const { container } = render(<CopyClipboardButton getText={() => 'Text to be copied'} />);
27
26
  document.execCommand = jest.fn();
28
- userEvent.click(container.firstChild);
27
+ fireEvent.click(container.firstChild);
29
28
  expect(document.execCommand).toHaveBeenCalledWith('copy');
30
29
  });
31
30
 
32
31
  it('copies the content and send a call back', () => {
33
32
  const cb = jest.fn();
34
33
  const { container } = render(<CopyClipboardButton text="text" copyCallback={cb} />);
35
- userEvent.click(container.firstChild);
34
+ fireEvent.click(container.firstChild);
36
35
  expect(cb).toHaveBeenCalledWith();
37
36
  });
@@ -52,6 +52,7 @@ export default class GeolocationDemo extends Component {
52
52
  });
53
53
  };
54
54
 
55
+ // eslint-disable-next-line class-methods-use-this
55
56
  getRequestparams = () => ({
56
57
  key: Constants.geolocationWoosmapSearchKey,
57
58
  radius: 200000,
@@ -12,6 +12,7 @@ export default class LocalitiesAllDemo extends Component {
12
12
  this.state = { usecase: 'localities' };
13
13
  }
14
14
 
15
+ // eslint-disable-next-line class-methods-use-this
15
16
  renderSubHeader = () => (
16
17
  <p>
17
18
  {tr('You can select bewteen 2 use cases:')}
@@ -145,6 +145,7 @@ export default class LocalitiesDemo extends Component {
145
145
  }
146
146
  };
147
147
 
148
+ // eslint-disable-next-line class-methods-use-this
148
149
  getHighlightedLocalityDesc = (locality) => {
149
150
  let { description } = locality;
150
151
 
@@ -1,4 +1,4 @@
1
- /* eslint-disable jsx-a11y/click-events-have-key-events */
1
+ /* eslint-disable */
2
2
  import axios from 'axios';
3
3
  import React, { Component } from 'react';
4
4
  import Demo from './SkeletonDemo';
@@ -1,4 +1,4 @@
1
- /* eslint-disable jsx-a11y/click-events-have-key-events */
1
+ /* eslint-disable */
2
2
  import axios from 'axios';
3
3
  import React, { Component } from 'react';
4
4
  import Demo from './SkeletonDemo';
@@ -1,4 +1,4 @@
1
- /* eslint-disable jsx-a11y/click-events-have-key-events */
1
+ /* eslint-disable */
2
2
  import React, { Component } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import Demo from './SkeletonDemo';
@@ -253,6 +253,7 @@ export default class MerchantDemo extends Component {
253
253
  this.setState({ transaction, place: {} });
254
254
  };
255
255
 
256
+ // eslint-disable-next-line class-methods-use-this
256
257
  getRequestparams = () => ({
257
258
  private_key: '{your private key}',
258
259
  });
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { fireEvent, render, screen } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
4
3
  import '@testing-library/jest-dom/extend-expect';
5
4
  import 'resize-observer-polyfill/dist/ResizeObserver.global';
6
5
 
@@ -28,7 +27,7 @@ it('opens / closes the dropdown ', () => {
28
27
  </Dropdown>
29
28
  );
30
29
  expect(container.firstChild).not.toHaveClass('open');
31
- userEvent.click(screen.getByText('My dropdown'));
30
+ fireEvent.click(screen.getByText('My dropdown'));
32
31
  expect(container.firstChild).toHaveClass('open');
33
32
  });
34
33
 
@@ -45,3 +45,7 @@ export const Default = Template.bind({});
45
45
  Default.args = {
46
46
  isSelector: false,
47
47
  };
48
+
49
+ Default.parameters = {
50
+ jest: ['DynamicTag.test.js'],
51
+ };
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { render, screen, getByRole, fireEvent } from '@testing-library/react';
3
3
  import { act } from 'react-dom/test-utils';
4
4
  import '@testing-library/jest-dom/extend-expect';
5
- import userEvent from '@testing-library/user-event';
6
5
 
7
6
  import DynamicTag from './DynamicTag';
8
7
 
@@ -29,7 +28,7 @@ it('remove a tag if closed', () => {
29
28
  const close = getByRole(tags[0], 'button');
30
29
  expect(close).toBeTruthy();
31
30
  act(() => {
32
- userEvent.click(close);
31
+ fireEvent.click(close);
33
32
  });
34
33
  expect(ref.current.getTags()).toEqual([]);
35
34
  });
@@ -40,13 +39,13 @@ it('add a tag by clicking the OK btn', () => {
40
39
  const input = screen.getByPlaceholderText('tags');
41
40
  expect(input).toBeTruthy();
42
41
 
43
- userEvent.type(input, 'mytag');
42
+ fireEvent.change(input, { target: { value: 'mytag' } });
44
43
  expect(input).toHaveValue('mytag');
45
44
 
46
45
  expect(ref.current.getTags()).toEqual([]);
47
46
  const ok = screen.getByRole('button');
48
47
  act(() => {
49
- userEvent.click(ok);
48
+ fireEvent.click(ok);
50
49
  });
51
50
  expect(ref.current.getTags()).toEqual(['mytag']);
52
51
  });
@@ -57,21 +56,22 @@ it('cant add the same value twice', () => {
57
56
  const input = screen.getByPlaceholderText('tags');
58
57
  expect(input).toBeTruthy();
59
58
 
60
- userEvent.type(input, 'mytag');
59
+ fireEvent.change(input, { target: { value: 'mytag' } });
60
+
61
61
  expect(input).toHaveValue('mytag');
62
62
 
63
63
  expect(ref.current.getTags()).toEqual([]);
64
64
  const ok = screen.getByRole('button');
65
65
  act(() => {
66
- userEvent.click(ok);
66
+ fireEvent.click(ok);
67
67
  });
68
68
  expect(ref.current.getTags()).toEqual(['mytag']);
69
69
 
70
- userEvent.type(input, 'mytag');
70
+ fireEvent.change(input, { target: { value: 'mytag' } });
71
71
  expect(input).toHaveValue('mytag');
72
72
 
73
73
  act(() => {
74
- userEvent.click(ok);
74
+ fireEvent.click(ok);
75
75
  });
76
76
 
77
77
  expect(screen.getByTestId('input-error')).toBeVisible();
@@ -1,3 +1,4 @@
1
+ /* eslint-disable */
1
2
  import React from 'react';
2
3
  import InfoMessage from './InfoMessage';
3
4
 
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
4
3
  import '@testing-library/jest-dom/extend-expect';
5
4
 
6
5
  import InfoMessage from './InfoMessage';
@@ -19,7 +18,7 @@ it('opens a modal with the content when clicking the button ', () => {
19
18
  } catch (e) {
20
19
  // nothink
21
20
  }
22
- userEvent.click(container.firstChild);
21
+ fireEvent.click(container.firstChild);
23
22
  const modal = screen.getByTestId('info-message-modal');
24
23
  expect(modal).toHaveClass('modal');
25
24
  });
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { render, screen, fireEvent } from '@testing-library/react';
3
3
  import '@testing-library/jest-dom/extend-expect';
4
4
  import { act } from 'react-dom/test-utils';
5
- import userEvent from '@testing-library/user-event';
6
5
 
7
6
  import Modal from './Modal';
8
7
 
@@ -28,7 +27,7 @@ it('is hidden after clicking cancel', () => {
28
27
  modalRef.current.open();
29
28
  });
30
29
  const cancel = screen.getByTestId('modal-cancel-button');
31
- userEvent.click(cancel);
30
+ fireEvent.click(cancel);
32
31
  try {
33
32
  screen.getByTestId('modal');
34
33
  expect('Modal displayed').toBeFalsy();
@@ -50,7 +49,7 @@ it('is hidden after clicking validate', () => {
50
49
  });
51
50
  expect(validateCb.mock.calls.length).toBe(0);
52
51
  const validate = screen.getByTestId('modal-validate-button');
53
- userEvent.click(validate);
52
+ fireEvent.click(validate);
54
53
  expect(validateCb.mock.calls.length).toBe(1);
55
54
  });
56
55
 
@@ -85,6 +85,7 @@ class Panel extends Component {
85
85
  );
86
86
  };
87
87
 
88
+ // eslint-disable-next-line class-methods-use-this
88
89
  getPlaceholderHeader = () => <span className="panel__header__fake-action" />;
89
90
 
90
91
  render() {
@@ -5,7 +5,7 @@ export default class PasswordStrengthBar extends Component {
5
5
  constructor(props) {
6
6
  super(props);
7
7
  this.state = {
8
- score: 0,
8
+ score: null,
9
9
  };
10
10
  }
11
11
 
@@ -44,25 +44,27 @@ export default class PasswordStrengthBar extends Component {
44
44
  }
45
45
 
46
46
  return (
47
- <div className="password-strength">
48
- <div className="password-strength__wrapper">
49
- {[1, 2, 3, 4].map((el) => (
50
- <Fragment key={`password-strength-bar-item-${el}`}>
51
- {el > 1 && <div className="password-strength__space" />}
52
- <div
53
- className="password-strength__item"
54
- data-testid={el}
55
- style={{
56
- backgroundColor: score >= el ? barColors[score] : barColors[0],
57
- }}
58
- />
59
- </Fragment>
60
- ))}
47
+ score !== null && (
48
+ <div className="password-strength">
49
+ <div className="password-strength__wrapper">
50
+ {[1, 2, 3, 4].map((el) => (
51
+ <Fragment key={`password-strength-bar-item-${el}`}>
52
+ {el > 1 && <div className="password-strength__space" />}
53
+ <div
54
+ className="password-strength__item"
55
+ data-testid={el}
56
+ style={{
57
+ backgroundColor: score >= el ? barColors[score] : barColors[0],
58
+ }}
59
+ />
60
+ </Fragment>
61
+ ))}
62
+ </div>
63
+ <p className="password-strength__desc" style={{ color: barColors[score] }}>
64
+ {newShortScoreWord}
65
+ </p>
61
66
  </div>
62
- <p className="password-strength__desc" style={{ color: barColors[score] }}>
63
- {newShortScoreWord}
64
- </p>
65
- </div>
67
+ )
66
68
  );
67
69
  }
68
70
  }
@@ -20,3 +20,7 @@ export const Default = Template.bind({});
20
20
  Default.args = {
21
21
  password: 'mypassword',
22
22
  };
23
+
24
+ Default.parameters = {
25
+ jest: ['PasswordStrengthBar.test.js'],
26
+ };
@@ -21,13 +21,6 @@ const green = '#25c281';
21
21
  const barColors = [grey, red, orange, blue, green];
22
22
 
23
23
  describe('PasswordStrengthBar', () => {
24
- it('renders', async () => {
25
- const { container } = render(<PasswordStrengthBar password="mypassword" />);
26
- expect(container.firstChild).toHaveClass('password-strength');
27
-
28
- const bar1 = await waitFor(() => screen.getByTestId('1'));
29
- expect(bar1).toHaveClass('password-strength__item');
30
- });
31
24
 
32
25
  describe('Color changing / complexity', () => {
33
26
  it('renders all bars in grey when password is too short', async () => {
@@ -9,6 +9,7 @@ import CreatableSelect from 'react-select/creatable';
9
9
  *
10
10
  */
11
11
  export default class Select extends Component {
12
+ // eslint-disable-next-line class-methods-use-this
12
13
  renderInput = (props) => {
13
14
  const { error, isCreatable, color, ...rest } = props;
14
15
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { render, screen } from '@testing-library/react';
2
+ import {render, screen, waitFor} from '@testing-library/react';
3
3
  import '@testing-library/jest-dom/extend-expect';
4
- import userEvent from '@testing-library/user-event';
4
+ import fireEvent from '@testing-library/user-event';
5
5
  import SnackBar from './SnackBar';
6
6
  import withSnackBar from './withSnackBar';
7
7
  import Button from '../Button/Button';
@@ -26,7 +26,7 @@ class SomeChildComponent extends React.Component {
26
26
 
27
27
  const WithSnackBarComponent = withSnackBar(SomeChildComponent);
28
28
 
29
- it('renders a Snackbar component ', () => {
29
+ it('renders a Snackbar component ', async () => {
30
30
  render(
31
31
  <SnackBar>
32
32
  <div>
@@ -40,10 +40,10 @@ it('renders a Snackbar component ', () => {
40
40
  } catch (e) {
41
41
  // nothing
42
42
  }
43
- userEvent.click(screen.getByTestId('open'));
44
- const snackbar = screen.getByTestId('snackbar');
43
+ fireEvent.click(screen.getByTestId('open'));
44
+ const snackbar = await waitFor(() => screen.getByTestId('snackbar'));
45
45
  expect(snackbar).toHaveTextContent('This is the content of the Snackbar.');
46
- userEvent.click(screen.getByTestId('close'));
46
+ fireEvent.click(screen.getByTestId('close'));
47
47
  try {
48
48
  screen.getByTestId('snackbar');
49
49
  expect('SnackBar exists').toBeFalsy();
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { fireEvent, render, screen } from '@testing-library/react';
3
3
  import '@testing-library/jest-dom/extend-expect';
4
- import userEvent from '@testing-library/user-event';
5
4
 
6
5
  import Switch from './Switch';
7
6
 
@@ -37,7 +36,7 @@ it('calls the onChange prop when clicking the label', () => {
37
36
  />
38
37
  );
39
38
  expect(onChange.mock.calls.length).toBe(0);
40
- userEvent.click(screen.getByRole('switch'));
39
+ fireEvent.click(screen.getByRole('switch'));
41
40
  expect(onChange.mock.calls.length).toBe(1);
42
41
  });
43
42
 
@@ -1,3 +1,4 @@
1
+ /* eslint-disable */
1
2
  import React from 'react';
2
3
  import Tab from './Tab';
3
4
 
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
4
3
  import '@testing-library/jest-dom/extend-expect';
5
4
 
6
5
  import Tab from './Tab';
@@ -28,7 +27,7 @@ it('renders a tab component with 2 tabs and content', () => {
28
27
  const firstTab = screen.getByText('First');
29
28
  expect(firstTab).toHaveClass('active');
30
29
 
31
- userEvent.click(screen.getByText('tab 2'));
30
+ fireEvent.click(screen.getByText('tab 2'));
32
31
  });
33
32
 
34
33
  it('changes active tab after click', () => {
@@ -39,7 +38,7 @@ it('changes active tab after click', () => {
39
38
  </Tab>
40
39
  );
41
40
 
42
- userEvent.click(screen.getByText('tab 2'));
41
+ fireEvent.click(screen.getByText('tab 2'));
43
42
  const secondTab = screen.getByText('Second');
44
43
  expect(secondTab).toHaveClass('active');
45
44
  });
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
- import { render, screen } from '@testing-library/react';
2
+ import { fireEvent, render, screen } from '@testing-library/react';
3
3
  import '@testing-library/jest-dom/extend-expect';
4
- import userEvent from '@testing-library/user-event';
5
4
 
6
5
  import withClickOutside from './withClickOutside';
7
6
 
@@ -29,8 +28,8 @@ it('renders a label component ', () => {
29
28
  </>
30
29
  );
31
30
  expect(handleClickOutside.mock.calls.length).toBe(0);
32
- userEvent.click(container.firstChild);
31
+ fireEvent.mouseDown(container.firstChild);
33
32
  expect(handleClickOutside.mock.calls.length).toBe(0);
34
- userEvent.click(screen.getByTestId('outside'));
33
+ fireEvent.mouseDown(screen.getByTestId('outside'));
35
34
  expect(handleClickOutside.mock.calls.length).toBe(1);
36
35
  });
@@ -1,8 +1,7 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  import React from 'react';
3
- import { render, screen } from '@testing-library/react';
3
+ import { render, screen, fireEvent } from '@testing-library/react';
4
4
  import '@testing-library/jest-dom/extend-expect';
5
- import userEvent from '@testing-library/user-event';
6
5
  import Input from '../Input/Input';
7
6
  import Button from '../Button/Button';
8
7
  import withFormValidation, { validationStrategy } from './withFormValidation';
@@ -42,13 +41,13 @@ it('renders a withFormValidation component ', () => {
42
41
  <WrappedWithFormValidation />
43
42
  </>
44
43
  );
45
- userEvent.click(screen.getByTestId('submit'));
44
+ fireEvent.click(screen.getByTestId('submit'));
46
45
  expect(screen.getByTestId('form')).toHaveTextContent('Required field');
47
46
  });
48
47
 
49
48
  it('validates min length', () => {
50
49
  let error = validationStrategy('minLength', { minLength: 6 }, 'short');
51
- expect(error).toEqual('Should be at least 6 chars long');
50
+ expect(error).toEqual('Should be at least 6 char long');
52
51
  error = validationStrategy('minLength', { minLength: 6 }, 'longvalue');
53
52
  expect(error).toBeFalsy();
54
53
  });
@@ -57,7 +56,7 @@ it('validates max length', () => {
57
56
  let error = validationStrategy('maxLength', { maxLength: 6 }, 'short');
58
57
  expect(error).toBeFalsy();
59
58
  error = validationStrategy('maxLength', { maxLength: 6 }, 'tooolong');
60
- expect(error).toEqual('Should be at most 6 chars long');
59
+ expect(error).toEqual('Should be at most 6 char long');
61
60
  });
62
61
 
63
62
  it('validates required', () => {