@shopgate/pwa-ui-shared 7.32.0-beta.9 → 7.32.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 (54) hide show
  1. package/DiscountBadge/index.js +1 -1
  2. package/FavoritesButton/FavoritesButton.d.ts +74 -0
  3. package/FavoritesButton/FavoritesButton.d.ts.map +1 -0
  4. package/FavoritesButton/FavoritesButton.js +87 -0
  5. package/FavoritesButton/connector.d.ts +3 -0
  6. package/FavoritesButton/connector.d.ts.map +1 -0
  7. package/FavoritesButton/index.d.ts +3 -0
  8. package/FavoritesButton/index.d.ts.map +1 -0
  9. package/FavoritesButton/index.js +1 -134
  10. package/Glow/index.js +4 -3
  11. package/NoResults/components/Icon/index.js +4 -1
  12. package/Price/index.js +11 -4
  13. package/PriceStriked/index.js +7 -1
  14. package/package.json +5 -5
  15. package/AccordionContainer/spec.js +0 -35
  16. package/ActionButton/spec.js +0 -66
  17. package/AddToCartButton/spec.js +0 -68
  18. package/Availability/spec.js +0 -42
  19. package/Button/spec.js +0 -38
  20. package/ButtonLink/spec.js +0 -29
  21. package/Chip/spec.js +0 -27
  22. package/ContextMenu/spec.js +0 -113
  23. package/Dialog/components/HtmlContentDialog/spec.js +0 -107
  24. package/Dialog/components/PipelineErrorDialog/spec.js +0 -105
  25. package/Dialog/components/TextMessageDialog/spec.js +0 -62
  26. package/Dialog/components/VariantSelectModal/spec.js +0 -55
  27. package/Dialog/spec.js +0 -84
  28. package/DiscountBadge/spec.js +0 -20
  29. package/FavoritesButton/spec.js +0 -131
  30. package/Form/Builder/classes/ActionListener/spec.js +0 -323
  31. package/Form/Builder/spec.js +0 -309
  32. package/Form/InfoField/spec.js +0 -12
  33. package/Form/Password/spec.js +0 -39
  34. package/Form/RadioGroup/spec.js +0 -97
  35. package/Form/Select/spec.js +0 -39
  36. package/Form/SelectContextChoices/spec.js +0 -36
  37. package/Form/TextField/spec.js +0 -124
  38. package/FormElement/spec.js +0 -68
  39. package/Glow/spec.js +0 -14
  40. package/IndicatorCircle/spec.js +0 -26
  41. package/PlaceholderLabel/spec.js +0 -26
  42. package/PlaceholderParagraph/spec.js +0 -26
  43. package/ProgressBar/spec.js +0 -14
  44. package/RadioButton/spec.js +0 -22
  45. package/RatingStars/spec.js +0 -94
  46. package/RippleButton/spec.js +0 -58
  47. package/Sheet/components/Header/components/SearchBar/spec.js +0 -22
  48. package/Sheet/components/Header/spec.js +0 -17
  49. package/Sheet/spec.js +0 -100
  50. package/TaxDisclaimer/spec.js +0 -44
  51. package/TextField/spec.js +0 -146
  52. package/ToggleIcon/spec.js +0 -39
  53. package/tsconfig.build.json +0 -16
  54. package/tsconfig.json +0 -3
package/TextField/spec.js DELETED
@@ -1,146 +0,0 @@
1
- import React from 'react';
2
- import { mount } from 'enzyme';
3
- import TextField from "./index";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- const inputProps = {
6
- name: 'test-input'
7
- };
8
- describe('<TextField />', () => {
9
- it('should render a simple text field', () => {
10
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
11
- ...inputProps
12
- }));
13
- expect(wrapper).toMatchSnapshot();
14
- expect(wrapper.find('input').length).toBe(1);
15
- });
16
- it('should render the text field as password', () => {
17
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
18
- ...inputProps,
19
- password: true
20
- }));
21
- expect(wrapper).toMatchSnapshot();
22
- expect(wrapper.find('input[type="password"]').length).toBe(1);
23
- });
24
- it('should render the text field with a default value', () => {
25
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
26
- ...inputProps,
27
- value: "FooBar"
28
- }));
29
- expect(wrapper).toMatchSnapshot();
30
- expect(wrapper.find('input[value="FooBar"]').length).toBe(1);
31
- });
32
- it('should trigger the onChange callback', () => {
33
- const onChangeMock = jest.fn();
34
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
35
- ...inputProps,
36
- onChange: onChangeMock
37
- }));
38
- wrapper.find('input').simulate('change', {
39
- target: {
40
- value: 'a'
41
- }
42
- });
43
- expect(onChangeMock).toHaveBeenCalledTimes(2);
44
- expect(wrapper.find('input').props().value).toEqual('a');
45
- });
46
- it('should receive the correct value while typing', () => {
47
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
48
- ...inputProps
49
- }));
50
- const input = wrapper.find('input');
51
- input.simulate('change', {
52
- target: {
53
- value: 'foobar'
54
- }
55
- });
56
- expect(wrapper).toMatchSnapshot();
57
- expect(input.instance().value).toBe('foobar');
58
- });
59
- it('should sanitize the input', () => {
60
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
61
- ...inputProps,
62
- onSanitize: value => value.toUpperCase()
63
- }));
64
- const input = wrapper.find('input');
65
- input.simulate('change', {
66
- target: {
67
- value: 'foobar'
68
- }
69
- });
70
- expect(wrapper).toMatchSnapshot();
71
- expect(input.instance().value).toBe('FOOBAR');
72
- });
73
- it('should trigger the validation callback', () => {
74
- const onValidateMock = jest.fn();
75
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
76
- ...inputProps,
77
- onValidate: onValidateMock
78
- }));
79
- expect(wrapper).toMatchSnapshot();
80
- expect(onValidateMock).toHaveBeenCalled();
81
- });
82
- it('should focus the input', () => {
83
- const onFocusMock = jest.fn();
84
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
85
- ...inputProps,
86
- onFocusChange: onFocusMock
87
- }));
88
- const input = wrapper.find('input');
89
- expect(wrapper).toMatchSnapshot();
90
- expect(onFocusMock).toHaveBeenCalledTimes(0);
91
- input.simulate('focus');
92
- expect(onFocusMock).toHaveBeenCalledTimes(1);
93
- expect(onFocusMock).toHaveBeenCalledWith(true);
94
- input.simulate('blur');
95
- expect(onFocusMock).toHaveBeenCalledTimes(2);
96
- expect(onFocusMock).toHaveBeenCalledWith(false);
97
- });
98
- it('should show the error message', () => {
99
- const errorText = 'This is an error here';
100
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
101
- ...inputProps,
102
- errorText: errorText
103
- }));
104
- expect(wrapper).toMatchSnapshot();
105
- expect(wrapper.find('Translate').at(2).props().string).toEqual(errorText);
106
- });
107
- it('should show the label', () => {
108
- const label = 'This is the label';
109
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
110
- ...inputProps,
111
- label: label
112
- }));
113
- expect(wrapper).toMatchSnapshot();
114
- expect(wrapper.find('Label').find('Translate').props().string).toEqual(label);
115
- });
116
- it('should show the hint text', () => {
117
- const hintText = 'This is the hint text';
118
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
119
- ...inputProps,
120
- hintText: hintText
121
- }));
122
- expect(wrapper).toMatchSnapshot();
123
- expect(wrapper.find('Hint').find('Translate').at(0).props().string).toEqual(hintText);
124
- });
125
- it('should replace the error text with custom validation error', () => {
126
- /**
127
- * A custom validation method that always returns an error.
128
- * @return {string} The error message.
129
- */
130
- const onValidate = () => 'Custom validation error';
131
- const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
132
- ...inputProps,
133
- onValidate: onValidate
134
- }));
135
- wrapper.find('input').simulate('blur');
136
- expect(wrapper).toMatchSnapshot();
137
- // Expect at least one element containing the validation error text.
138
- expect(wrapper.findWhere(node => {
139
- try {
140
- return node.text() === onValidate();
141
- } catch (e) {
142
- return false;
143
- }
144
- }).length).toBeGreaterThan(0);
145
- });
146
- });
@@ -1,39 +0,0 @@
1
- import React from 'react';
2
- import { mount } from 'enzyme';
3
- import ToggleIcon from "./index";
4
- import VisibilityIcon from "../icons/VisibilityIcon";
5
- import VisibilityOffIcon from "../icons/VisibilityOffIcon";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const inputProps = {
8
- onIcon: /*#__PURE__*/_jsx(VisibilityIcon, {}),
9
- offIcon: /*#__PURE__*/_jsx(VisibilityOffIcon, {})
10
- };
11
- describe('<ToggleIcon>', () => {
12
- it('should render a toggle icon', () => {
13
- const wrapper = mount(/*#__PURE__*/_jsx(ToggleIcon, {
14
- ...inputProps
15
- }));
16
- expect(wrapper).toMatchSnapshot();
17
- expect(wrapper.find('VisibilityIcon').length).toBe(1);
18
- expect(wrapper.find('VisibilityOffIcon').length).toBe(0);
19
- });
20
- it('should render a toggle icon with false as default', () => {
21
- const wrapper = mount(/*#__PURE__*/_jsx(ToggleIcon, {
22
- ...inputProps,
23
- on: false
24
- }));
25
- expect(wrapper).toMatchSnapshot();
26
- expect(wrapper.find('VisibilityIcon').length).toBe(0);
27
- expect(wrapper.find('VisibilityOffIcon').length).toBe(1);
28
- });
29
- it('should trigger the toggleHandler callback', () => {
30
- const mockToggleHandler = jest.fn();
31
- const wrapper = mount(/*#__PURE__*/_jsx(ToggleIcon, {
32
- ...inputProps,
33
- toggleHandler: mockToggleHandler
34
- }));
35
- wrapper.find('div').simulate('click');
36
- expect(wrapper).toMatchSnapshot();
37
- expect(mockToggleHandler.mock.calls.length).toBe(1);
38
- });
39
- });
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "@shopgate/engage/tsconfig.build.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "."
6
- },
7
- "include": ["**/*.ts", "**/*.tsx"],
8
- "exclude": [
9
- "dist",
10
- "node_modules",
11
- "**/*.spec.*",
12
- "**/__tests__/**",
13
- "**/__snapshots__/**",
14
- "coverage"
15
- ]
16
- }
package/tsconfig.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "@shopgate/engage/tsconfig.json",
3
- }