@shopgate/pwa-ui-shared 7.32.0-beta.9 → 7.32.1-beta.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.
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
@@ -1,68 +0,0 @@
1
- import React from 'react';
2
- import { mount } from 'enzyme';
3
- import FormElement from "./index";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- const inputProps = {
6
- htmlFor: 'test-input'
7
- };
8
- describe('<FormElement />', () => {
9
- // Simple tests for snapshots
10
- const tests = {
11
- 'should render a form element with no children': {
12
- props: {}
13
- },
14
- 'should render a form element with 1 child': {
15
- props: {
16
- children: [/*#__PURE__*/_jsx("input", {}, "test-key")]
17
- }
18
- },
19
- 'should render a focused form element': {
20
- props: {
21
- isFocused: true
22
- }
23
- },
24
- 'should show the label': {
25
- props: {
26
- label: 'The label'
27
- },
28
- find: 'Label',
29
- equal: 'The label'
30
- },
31
- 'should show the error message': {
32
- props: {
33
- errorText: 'The error text'
34
- },
35
- find: 'ErrorText',
36
- equal: 'The error text'
37
- },
38
- 'should show the placeholder text': {
39
- props: {
40
- placeholder: 'The placeholder'
41
- },
42
- find: 'Placeholder',
43
- equal: 'The placeholder'
44
- }
45
- };
46
- Object.keys(tests).forEach(test => {
47
- it(test, () => {
48
- const testFixtures = tests[test];
49
- const wrapper = mount(/*#__PURE__*/_jsx(FormElement, {
50
- ...inputProps,
51
- ...testFixtures.props
52
- }));
53
- expect(wrapper).toMatchSnapshot();
54
- if (testFixtures.find) {
55
- expect(wrapper.find(testFixtures.find).find('Translate').props().string).toEqual(testFixtures.equal);
56
- }
57
- });
58
- });
59
- it('Should hide placeholder with hasValue', () => {
60
- const wrapper = mount(/*#__PURE__*/_jsx(FormElement, {
61
- label: "testlabel",
62
- ...inputProps,
63
- hasValue: true
64
- }));
65
- expect(wrapper).toMatchSnapshot();
66
- expect(wrapper.find('Placeholder').props().visible).toEqual(false);
67
- });
68
- });
package/Glow/spec.js DELETED
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import Glow from "./index";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- describe('<Glow />', () => {
6
- it('should render with a smile', () => {
7
- const wrapper = render(/*#__PURE__*/_jsx(Glow, {
8
- children: /*#__PURE__*/_jsx("p", {
9
- children: "Glowing!"
10
- })
11
- }));
12
- expect(wrapper.asFragment()).toMatchSnapshot();
13
- });
14
- });
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { shallow, mount } from 'enzyme';
3
- import IndicatorCircle from "./index";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- describe('<IndicatorCircle />', () => {
6
- it('should apply the given size', () => {
7
- const wrapper = shallow(/*#__PURE__*/_jsx(IndicatorCircle, {
8
- size: 32
9
- }));
10
- expect(wrapper).toMatchSnapshot();
11
- const svg = wrapper.find('svg');
12
- expect(svg.props().width).toBe(32);
13
- expect(svg.props().height).toBe(32);
14
- });
15
- it('should apply the given color', () => {
16
- const wrapper = mount(/*#__PURE__*/_jsx(IndicatorCircle, {
17
- size: 32,
18
- color: "#fff",
19
- strokeWidth: 4
20
- }));
21
- expect(wrapper).toMatchSnapshot();
22
- const circleHtml = wrapper.find('circle');
23
- expect(circleHtml.html()).toMatch(/class="[^"]*"/);
24
- expect(circleHtml.html()).not.toEqual('');
25
- });
26
- });
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { mount } from 'enzyme';
3
- import PlaceholderLabel from "./index";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- describe('<PlaceholderLabel />', () => {
6
- it('should render placeholder ', () => {
7
- const wrapper = mount(/*#__PURE__*/_jsx(PlaceholderLabel, {
8
- ready: false,
9
- children: /*#__PURE__*/_jsx("h1", {
10
- children: "foo"
11
- })
12
- }));
13
- expect(wrapper).toMatchSnapshot();
14
- expect(wrapper.find('h1').length).toEqual(0);
15
- });
16
- it('should render children', () => {
17
- const wrapper = mount(/*#__PURE__*/_jsx(PlaceholderLabel, {
18
- ready: true,
19
- children: /*#__PURE__*/_jsx("h1", {
20
- children: "foo"
21
- })
22
- }));
23
- expect(wrapper).toMatchSnapshot();
24
- expect(wrapper.find('h1').length).toEqual(1);
25
- });
26
- });
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { mount } from 'enzyme';
3
- import PlaceholderParagraph from "./index";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- describe('<PlaceholderParagraph />', () => {
6
- it('should render placeholder ', () => {
7
- const wrapper = mount(/*#__PURE__*/_jsx(PlaceholderParagraph, {
8
- ready: false,
9
- children: /*#__PURE__*/_jsx("h1", {
10
- children: "foo"
11
- })
12
- }));
13
- expect(wrapper).toMatchSnapshot();
14
- expect(wrapper.find('h1').length).toEqual(0);
15
- });
16
- it('should render children', () => {
17
- const wrapper = mount(/*#__PURE__*/_jsx(PlaceholderParagraph, {
18
- ready: true,
19
- children: /*#__PURE__*/_jsx("h1", {
20
- children: "foo"
21
- })
22
- }));
23
- expect(wrapper).toMatchSnapshot();
24
- expect(wrapper.find('h1').length).toEqual(1);
25
- });
26
- });
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import Transition from 'react-transition-group/Transition';
4
- import ProgressBar from "./index";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- describe('<ProgressBar />', () => {
7
- it('renders an indeterminate progress bar.', () => {
8
- const wrapper = shallow(/*#__PURE__*/_jsx(ProgressBar, {
9
- isVisible: true
10
- }));
11
- expect(wrapper).toMatchSnapshot();
12
- expect(wrapper.find(Transition).length).toBe(1);
13
- });
14
- });
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import { mount } from 'enzyme';
3
- import CheckedIcon from "../icons/RadioCheckedIcon";
4
- import UncheckedIcon from "../icons/RadioUncheckedIcon";
5
- import RadioButton from "./index";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- describe('RadioButton', () => {
8
- it('should render selected RadioButton', () => {
9
- const wrapper = mount(/*#__PURE__*/_jsx(RadioButton, {
10
- checked: true
11
- }));
12
- expect(wrapper.find(CheckedIcon).exists()).toBe(true);
13
- expect(wrapper.find(UncheckedIcon).exists()).toBe(false);
14
- expect(wrapper).toMatchSnapshot();
15
- });
16
- it('should render unselected RadioButton', () => {
17
- const wrapper = mount(/*#__PURE__*/_jsx(RadioButton, {}));
18
- expect(wrapper.find(CheckedIcon).exists()).toBe(false);
19
- expect(wrapper.find(UncheckedIcon).exists()).toBe(true);
20
- expect(wrapper).toMatchSnapshot();
21
- });
22
- });
@@ -1,94 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOptions';
4
- import StarIcon from "../icons/StarIcon";
5
- import StarHalfIcon from "../icons/StarHalfIcon";
6
- import RatingStars from "./index";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- const numEmptyStars = 5;
9
- describe('<RatingStars />', () => {
10
- it('renders with value of 50', () => {
11
- const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
12
- value: 50
13
- }), mockRenderOptions);
14
- expect(wrapper).toMatchSnapshot();
15
- expect(wrapper.find(StarIcon).length).toBe(numEmptyStars + 2);
16
- expect(wrapper.find(StarHalfIcon).length).toBe(1);
17
- });
18
- it('renders with value of 0', () => {
19
- const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
20
- value: 0
21
- }), mockRenderOptions);
22
- expect(wrapper).toMatchSnapshot();
23
- expect(wrapper.find(StarIcon).length).toBe(numEmptyStars);
24
- expect(wrapper.find(StarHalfIcon).length).toBe(0);
25
- });
26
- it('renders with value of 100', () => {
27
- const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
28
- value: 100
29
- }), mockRenderOptions);
30
- expect(wrapper).toMatchSnapshot();
31
- expect(wrapper.find(StarIcon).length).toBe(numEmptyStars + 5);
32
- expect(wrapper.find(StarHalfIcon).length).toBe(0);
33
- });
34
- it('should change rating on click', () => {
35
- const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
36
- value: 100,
37
- isSelectable: true
38
- }), mockRenderOptions);
39
- expect(wrapper).toMatchSnapshot();
40
- expect(wrapper.find(StarIcon).length).toBe(10);
41
- wrapper.setProps({
42
- value: 20
43
- });
44
- expect(wrapper.find(StarIcon).length).toBe(6);
45
- wrapper.setProps({
46
- value: 70
47
- });
48
- expect(wrapper.find(StarIcon).length).toBe(8);
49
- expect(wrapper.find(StarHalfIcon).length).toBe(1);
50
- expect(wrapper).toMatchSnapshot();
51
- });
52
- it('should call onSelection with the clicked rating in selectable mode', () => {
53
- const selections = [];
54
- const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
55
- value: 20,
56
- isSelectable: true,
57
- onSelection: e => {
58
- selections.push(e.target.value);
59
- wrapper.setProps({
60
- value: e.target.value
61
- });
62
- }
63
- }), mockRenderOptions);
64
-
65
- // Only the empty-star layer is interactive: one button per position, always five.
66
- // The decorative filled overlay is pointer-transparent and carries no buttons.
67
- expect(wrapper.find('[role="button"]').length).toBe(numEmptyStars);
68
-
69
- // Regression: at a low rating the higher positions used to be covered by the
70
- // filled layer's invisible placeholders, which swallowed the click. Clicking the
71
- // 5th star must still raise the rating to the full 5 stars.
72
- wrapper.find('[role="button"]').at(4).simulate('click', {
73
- target: {}
74
- });
75
- expect(selections).toEqual([100]);
76
-
77
- // The interactive layer is unaffected by the rating; clicking the 1st star lowers it.
78
- expect(wrapper.find('[role="button"]').length).toBe(numEmptyStars);
79
- wrapper.find('[role="button"]').at(0).simulate('click', {
80
- target: {}
81
- });
82
- expect(selections).toEqual([100, 20]);
83
- });
84
- it('should NOT call onSelection callback when component is NOT selectable', () => {
85
- const spy = jest.fn();
86
- const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
87
- value: 100,
88
- onSelection: spy
89
- }), mockRenderOptions);
90
- wrapper.find(StarIcon).at(5).parent('div').simulate('click');
91
- expect(wrapper.find('[role="button"]').length).toBe(0);
92
- expect(spy.mock.calls.length).toBe(0);
93
- });
94
- });
@@ -1,58 +0,0 @@
1
- import trim from 'lodash/trim';
2
- import React from 'react';
3
- import { mount } from 'enzyme';
4
- import BaseButton from '@shopgate/pwa-common/components/Button';
5
- import Ripple from "../Ripple";
6
- import RippleButton from "./index";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- describe('<RippleButton />', () => {
9
- it('should render as a regular ripple button effect if type is omitted', () => {
10
- const wrapper = mount(/*#__PURE__*/_jsx(RippleButton, {
11
- children: "Press me"
12
- }));
13
- expect(wrapper).toMatchSnapshot();
14
- expect(wrapper.find(Ripple).text()).toEqual('Press me');
15
- });
16
- it('should render as a regular ripple button if type is explicitly defined', () => {
17
- const wrapper = mount(/*#__PURE__*/_jsx(RippleButton, {
18
- type: "regular",
19
- children: "Press me"
20
- }));
21
- const base = wrapper.find(BaseButton);
22
- expect(base.exists()).toBe(true);
23
- expect(trim(base.props().className)).toMatch(/^ui-shared__button /);
24
- expect(trim(base.props().className)).toContain('ui-shared__ripple-button');
25
- expect(wrapper.find(Ripple).render().text()).toEqual('Press me');
26
- expect(wrapper).toMatchSnapshot();
27
- });
28
- it('should render as a primary ripple button', () => {
29
- const wrapper = mount(/*#__PURE__*/_jsx(RippleButton, {
30
- type: "primary",
31
- children: "Press me"
32
- }));
33
- const base = wrapper.find(BaseButton);
34
- expect(trim(base.props().className)).toMatch(/^ui-shared__button /);
35
- expect(trim(base.props().className)).toContain('ui-shared__ripple-button');
36
- expect(wrapper.find(Ripple).render().text()).toEqual('Press me');
37
- expect(wrapper).toMatchSnapshot();
38
- });
39
- it('should render as a secondary ripple button', () => {
40
- const wrapper = mount(/*#__PURE__*/_jsx(RippleButton, {
41
- type: "secondary",
42
- children: "Press me"
43
- }));
44
- const base = wrapper.find(BaseButton);
45
- expect(trim(base.props().className)).toMatch(/^ui-shared__button /);
46
- expect(trim(base.props().className)).toContain('ui-shared__ripple-button');
47
- expect(wrapper.find(Ripple).render().text()).toEqual('Press me');
48
- expect(wrapper).toMatchSnapshot();
49
- });
50
- it('should render as a disabled ripple button', () => {
51
- const wrapper = mount(/*#__PURE__*/_jsx(RippleButton, {
52
- disabled: true,
53
- children: "Press me"
54
- }));
55
- expect(wrapper.find(BaseButton).props().disabled).toBe(true);
56
- expect(wrapper).toMatchSnapshot();
57
- });
58
- });
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import { mount } from 'enzyme';
3
- import SearchBar from "./index";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- describe('<SearchBar />', () => {
6
- it('should call handleChange on input', async () => {
7
- const handleChange = jest.fn();
8
- const wrapper = await mount(/*#__PURE__*/_jsx(SearchBar, {
9
- handleChange: handleChange
10
- }));
11
- expect(wrapper).toMatchSnapshot();
12
- // Update input
13
- wrapper.find('input').first().simulate('change', {
14
- target: {
15
- name: 'search',
16
- value: 'asdf'
17
- }
18
- });
19
- // Should call with updated state.
20
- expect(handleChange).toHaveBeenCalledWith('asdf');
21
- });
22
- });
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOptions';
4
- import Header from "./index";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- describe('<Header />', () => {
7
- it('should render with correct title', () => {
8
- const title = 'My Title';
9
- const wrapper = shallow(/*#__PURE__*/_jsx(Header, {
10
- title: title
11
- }), mockRenderOptions);
12
- expect(wrapper).toMatchSnapshot();
13
- expect(wrapper.find({
14
- variant: 'h3'
15
- }).first().props().children).toEqual(title);
16
- });
17
- });
package/Sheet/spec.js DELETED
@@ -1,100 +0,0 @@
1
- import React from 'react';
2
- import { shallow, mount } from 'enzyme';
3
- import Drawer from '@shopgate/pwa-common/components/Drawer';
4
- import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOptions';
5
- import UIEvents from '@shopgate/pwa-core/emitters/ui';
6
- import Sheet, { SHEET_EVENTS } from "./index";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- window.requestAnimationFrame = () => {};
9
- jest.mock('@shopgate/pwa-core/emitters/ui', () => ({
10
- emit: jest.fn()
11
- }));
12
- jest.mock('@shopgate/engage/a11y/components');
13
- describe('<Sheet />', () => {
14
- it('should render closed without content', () => {
15
- const wrapper = shallow(/*#__PURE__*/_jsx(Sheet, {}));
16
- expect(wrapper).toMatchSnapshot();
17
- });
18
- it('should render opened without content', () => {
19
- const wrapper = shallow(/*#__PURE__*/_jsx(Sheet, {
20
- isOpen: true
21
- }));
22
- expect(wrapper).toMatchSnapshot();
23
- });
24
- it('should render with content and title', () => {
25
- const wrapper = shallow(/*#__PURE__*/_jsx(Sheet, {
26
- isOpen: true,
27
- title: "Test-Title",
28
- children: /*#__PURE__*/_jsx("div", {
29
- children: "Test"
30
- })
31
- }));
32
- expect(wrapper).toMatchSnapshot();
33
- });
34
- it('should call onDidOpen callback when the Sheet was opened', () => {
35
- const onOpen = jest.fn();
36
- const onDidOpen = jest.fn();
37
- const wrapper = mount(/*#__PURE__*/_jsx(Sheet, {
38
- isOpen: false,
39
- onOpen: onOpen,
40
- onDidOpen: onDidOpen,
41
- children: /*#__PURE__*/_jsx("div", {
42
- children: "Test"
43
- })
44
- }), mockRenderOptions);
45
- expect(onOpen).not.toHaveBeenCalled();
46
- expect(onDidOpen).not.toHaveBeenCalled();
47
- wrapper.setProps({
48
- isOpen: true
49
- });
50
- wrapper.update();
51
- expect(onOpen).toHaveBeenCalled();
52
- wrapper.find(Drawer).simulate('animationEnd');
53
- expect(onDidOpen).toHaveBeenCalled();
54
- expect(UIEvents.emit).nthCalledWith(1, SHEET_EVENTS.OPEN);
55
- });
56
- it('should trigger onClose callback and close the Sheet', () => {
57
- const onCloseSpy = jest.fn();
58
- const wrapper = mount(/*#__PURE__*/_jsx(Sheet, {
59
- isOpen: true,
60
- title: "Test-Title",
61
- onClose: onCloseSpy,
62
- children: /*#__PURE__*/_jsx("div", {
63
- children: "Test"
64
- })
65
- }), mockRenderOptions);
66
-
67
- // Trigger a click on the close button of the Sheet.
68
- wrapper.find('button').first().simulate('click');
69
- return new Promise(resolve => {
70
- // Wait until the drawer is closed and has updated it's state.
71
- setTimeout(() => {
72
- resolve();
73
- }, wrapper.find(Drawer).prop('animation').duration);
74
- }).then(() => {
75
- // Check if onClose callback was called.
76
- expect(onCloseSpy).toHaveBeenCalled();
77
-
78
- // Check if the Drawer component was closed.
79
- expect(wrapper.find(Drawer).prop('isOpen')).not.toBeTruthy();
80
- expect(wrapper).toMatchSnapshot();
81
- wrapper.find(Drawer).simulate('animationEnd');
82
- expect(UIEvents.emit).lastCalledWith(SHEET_EVENTS.CLOSE);
83
- });
84
- });
85
- it('should open', () => {
86
- const wrapper = mount(/*#__PURE__*/_jsx(Sheet, {
87
- isOpen: false,
88
- title: "Test-Title",
89
- children: /*#__PURE__*/_jsx("div", {
90
- children: "Test"
91
- })
92
- }), mockRenderOptions);
93
- wrapper.setProps({
94
- isOpen: true
95
- });
96
- wrapper.update();
97
- expect(wrapper.find(Drawer).prop('isOpen')).toBeTruthy();
98
- expect(wrapper).toMatchSnapshot();
99
- });
100
- });
@@ -1,44 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import { I18n } from '@shopgate/engage/components';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- jest.mock('@shopgate/engage/components');
6
- jest.mock('@shopgate/engage/styles', () => ({
7
- makeStyles: () => function mockUseStylesFactory() {
8
- return function useStylesMock() {
9
- return {
10
- classes: {
11
- text: 'mock-class-text'
12
- },
13
- cx: (...classes) => classes.filter(Boolean).join(' ')
14
- };
15
- };
16
- },
17
- keyframes: () => ({})
18
- }));
19
- jest.mock('@shopgate/engage/core/hooks/useWidgetSettings', () => ({
20
- useWidgetSettings: jest.fn().mockReturnValue({
21
- show: null,
22
- hint: '*',
23
- text: null
24
- })
25
- }));
26
- describe('<TaxDisclaimer />', () => {
27
- afterEach(() => {
28
- jest.resetModules();
29
- });
30
- it('should display the component', () => {
31
- jest.mock('@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer', () => true);
32
- const TaxDisclaimer = jest.requireActual("./index").default;
33
- const wrapper = shallow(/*#__PURE__*/_jsx(TaxDisclaimer, {}));
34
- expect(wrapper).toMatchSnapshot();
35
- expect(wrapper.find(I18n.Text).exists()).toBe(true);
36
- });
37
- it('should display null', () => {
38
- jest.mock('@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer', () => false);
39
- const TaxDisclaimer = jest.requireActual("./index").default;
40
- const wrapper = shallow(/*#__PURE__*/_jsx(TaxDisclaimer, {}));
41
- expect(wrapper).toMatchSnapshot();
42
- expect(wrapper.find(I18n.Text).exists()).toBe(false);
43
- });
44
- });