@transferwise/components 0.0.0-experimental-5c47442 → 0.0.0-experimental-71a6c2e

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-5c47442",
3
+ "version": "0.0.0-experimental-71a6c2e",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -92,8 +92,8 @@
92
92
  "rollup-preserve-directives": "^1.1.1",
93
93
  "storybook": "^8.2.2",
94
94
  "@transferwise/less-config": "3.1.0",
95
- "@wise/components-theming": "1.6.1",
96
- "@transferwise/neptune-css": "14.22.0"
95
+ "@transferwise/neptune-css": "14.22.0",
96
+ "@wise/components-theming": "1.6.1"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "@transferwise/icons": "^3.13.1",
@@ -5,7 +5,6 @@ import { FastFlag as FastFlagIcon } from '@transferwise/icons';
5
5
  import { Nudge, Title, Typography } from '..';
6
6
 
7
7
  import ActionOption from './ActionOption';
8
- import { background } from '@storybook/theming';
9
8
 
10
9
  export default {
11
10
  component: ActionOption,
@@ -110,7 +110,7 @@ button.np-option {
110
110
  }
111
111
  }
112
112
 
113
- @media (max-width: 320px) {
113
+ @media (--screen-400-zoom) {
114
114
  .np-option-additional-content {
115
115
  margin-top: -3px;
116
116
  }
@@ -0,0 +1,24 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { render } from '../test-utils';
3
+ import withNextPortalWrapper from './withNextPortal';
4
+
5
+ describe('withNextPortalWrapper', () => {
6
+ it('renders component in React portal', () => {
7
+ type Props = Pick<
8
+ HTMLAttributes<HTMLButtonElement>,
9
+ 'id' | 'children' | 'className' | 'aria-label'
10
+ >;
11
+ const RandomComponentForTest = withNextPortalWrapper((props: Props) => <span {...props} />);
12
+ const data: Props = {
13
+ 'aria-label': 'Test aria-label',
14
+ id: 'random-component',
15
+ children: 'Test Children',
16
+ };
17
+ render(<RandomComponentForTest {...data} />);
18
+
19
+ const componentDomRef = document.body.lastChild;
20
+ expect(componentDomRef).toHaveAttribute('aria-label', data['aria-label']);
21
+ expect(componentDomRef).toHaveTextContent(data.children as string);
22
+ expect(componentDomRef).toHaveAttribute('id', data.id);
23
+ });
24
+ });
@@ -1,22 +0,0 @@
1
- import { mount } from 'enzyme';
2
- import ReactDOM from 'react-dom';
3
-
4
- import withNextPortal from './withNextPortal';
5
-
6
- jest.mock('react-dom');
7
-
8
- describe('withNextPortal', () => {
9
- it('should return a function', () => {
10
- expect(typeof withNextPortal()).toBe('function');
11
- });
12
-
13
- it('should create a portal with the component', () => {
14
- ReactDOM.createPortal.mockImplementation(() => null);
15
- const props = {};
16
- const Component = withNextPortal(AnyComponent);
17
- mount(<Component {...props} />);
18
- expect(ReactDOM.createPortal).toHaveBeenCalledTimes(1);
19
- });
20
-
21
- const AnyComponent = () => <div>Test div</div>;
22
- });