@npm_leadtech/legal-lib-components 7.89.0 → 7.89.4
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/dist/css/styles.css +16 -0
- package/dist/images/componentsSvg/CloseIcon.js +1 -1
- package/dist/images/componentsSvg/CloseIcon.tsx +1 -1
- package/dist/images/componentsSvg/Done24px.d.ts +1 -1
- package/dist/images/componentsSvg/Done24px.js +1 -1
- package/dist/images/componentsSvg/Done24px.tsx +2 -2
- package/dist/images/componentsSvg/NewRelease24p.d.ts +1 -1
- package/dist/images/componentsSvg/NewRelease24p.js +1 -1
- package/dist/images/componentsSvg/NewRelease24p.tsx +2 -3
- package/dist/images/componentsSvg/Sign24px.d.ts +2 -2
- package/dist/images/componentsSvg/Sign24px.js +1 -1
- package/dist/images/componentsSvg/Sign24px.tsx +7 -6
- package/dist/images/componentsSvg/Time24px.d.ts +1 -1
- package/dist/images/componentsSvg/Time24px.js +1 -1
- package/dist/images/componentsSvg/Time24px.tsx +2 -3
- package/dist/src/components/atoms/Button/Button.js +1 -1
- package/dist/src/components/atoms/Button/Button.scss +19 -0
- package/dist/src/components/atoms/Button/Button.tsx +1 -1
- package/dist/src/components/atoms/Button/ButtonProps.types.d.ts +1 -1
- package/dist/src/components/atoms/Button/ButtonProps.types.ts +1 -0
- package/dist/src/components/atoms/DocumentStatus/DocumentStatus.js +5 -15
- package/dist/src/components/atoms/DocumentStatus/DocumentStatus.styled.js +41 -40
- package/dist/src/components/atoms/DocumentStatus/DocumentStatus.styled.ts +41 -40
- package/dist/src/components/atoms/DocumentStatus/DocumentStatus.tsx +7 -35
- package/dist/src/components/atoms/DocumentStatus/DocumentStatusProps.types.d.ts +4 -6
- package/dist/src/components/atoms/DocumentStatus/DocumentStatusProps.types.ts +5 -6
- package/dist/src/components/atoms/SignerStatusItem/SignerStatusItem.d.ts +3 -0
- package/dist/src/components/atoms/SignerStatusItem/SignerStatusItem.js +16 -0
- package/dist/src/components/atoms/SignerStatusItem/SignerStatusItem.styled.d.ts +1 -0
- package/dist/src/components/atoms/SignerStatusItem/SignerStatusItem.styled.js +60 -0
- package/dist/src/components/atoms/SignerStatusItem/SignerStatusItem.styled.ts +61 -0
- package/dist/src/components/atoms/SignerStatusItem/SignerStatusItem.tsx +28 -0
- package/dist/src/components/atoms/SignerStatusItem/SignerStatusItemProps.types.d.ts +6 -0
- package/dist/src/components/atoms/SignerStatusItem/SignerStatusItemProps.types.js +1 -0
- package/dist/src/components/atoms/SignerStatusItem/SignerStatusItemProps.types.ts +7 -0
- package/dist/src/components/atoms/SignerStatusItem/index.d.ts +2 -0
- package/dist/src/components/atoms/SignerStatusItem/index.js +1 -0
- package/dist/src/components/atoms/SignerStatusItem/index.ts +2 -0
- package/dist/src/components/atoms/Tooltip/Tooltip.js +0 -2
- package/dist/src/components/atoms/Tooltip/Tooltip.tsx +0 -2
- package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContent.d.ts +3 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContent.js +7 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContent.styled.d.ts +1 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContent.styled.js +22 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContent.styled.ts +23 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContent.tsx +38 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContentProps.types.d.ts +9 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContentProps.types.js +1 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContentProps.types.ts +10 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/index.d.ts +2 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/index.js +1 -0
- package/dist/src/components/molecules/SignersStatusTooltipContent/index.ts +2 -0
- package/dist/src/components/molecules/TextInput/tests/Input.test.tsx +29 -18
- package/dist/src/components/molecules/TextInput/tests/TextInput.test.tsx +16 -9
- package/dist/src/components/molecules/TextInput/tests/TextInputMessage.test.tsx +2 -2
- package/dist/src/components/molecules/TextInput/tests/TextInputTooltip.test.tsx +1 -1
- package/dist/src/components/molecules/index.d.ts +1 -0
- package/dist/src/components/molecules/index.js +1 -0
- package/dist/src/components/molecules/index.ts +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const SignerStatusItemStyled = styled.li `
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
padding: 0.25rem 0.5rem;
|
|
6
|
+
border-radius: 0.25rem;
|
|
7
|
+
font-family: var(--font-sans);
|
|
8
|
+
list-style: none;
|
|
9
|
+
gap: 0.25rem;
|
|
10
|
+
|
|
11
|
+
.signer-status-item__icon {
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
width: 16px;
|
|
14
|
+
height: 16px;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
color: currentColor;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.signer-status-item--signed {
|
|
22
|
+
background-color: var(--primary-main-light-4);
|
|
23
|
+
|
|
24
|
+
svg > path {
|
|
25
|
+
fill: var(--primary-main-light-1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.signer-status-item--in_progress {
|
|
30
|
+
background-color: var(--neutral-neutral-6);
|
|
31
|
+
|
|
32
|
+
svg > path {
|
|
33
|
+
fill: var(--neutral-neutral-2);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.signer-status-item--declined {
|
|
38
|
+
background-color: var(--error-error-3);
|
|
39
|
+
|
|
40
|
+
svg > path {
|
|
41
|
+
fill: var(--error-main);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.signer-status-item--awaiting {
|
|
46
|
+
background-color: var(--secondary-main-light-4);
|
|
47
|
+
|
|
48
|
+
svg > path {
|
|
49
|
+
fill: var(--secondary-main-dark-2);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.signer-status-item--no_response {
|
|
54
|
+
background-color: var(--neutral-neutral-4);
|
|
55
|
+
|
|
56
|
+
svg > path {
|
|
57
|
+
fill: var(--neutral-neutral-1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const SignerStatusItemStyled = styled.li`
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
padding: 0.25rem 0.5rem;
|
|
7
|
+
border-radius: 0.25rem;
|
|
8
|
+
font-family: var(--font-sans);
|
|
9
|
+
list-style: none;
|
|
10
|
+
gap: 0.25rem;
|
|
11
|
+
|
|
12
|
+
.signer-status-item__icon {
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
width: 16px;
|
|
15
|
+
height: 16px;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
color: currentColor;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.signer-status-item--signed {
|
|
23
|
+
background-color: var(--primary-main-light-4);
|
|
24
|
+
|
|
25
|
+
svg > path {
|
|
26
|
+
fill: var(--primary-main-light-1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.signer-status-item--in_progress {
|
|
31
|
+
background-color: var(--neutral-neutral-6);
|
|
32
|
+
|
|
33
|
+
svg > path {
|
|
34
|
+
fill: var(--neutral-neutral-2);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.signer-status-item--declined {
|
|
39
|
+
background-color: var(--error-error-3);
|
|
40
|
+
|
|
41
|
+
svg > path {
|
|
42
|
+
fill: var(--error-main);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.signer-status-item--awaiting {
|
|
47
|
+
background-color: var(--secondary-main-light-4);
|
|
48
|
+
|
|
49
|
+
svg > path {
|
|
50
|
+
fill: var(--secondary-main-dark-2);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.signer-status-item--no_response {
|
|
55
|
+
background-color: var(--neutral-neutral-4);
|
|
56
|
+
|
|
57
|
+
svg > path {
|
|
58
|
+
fill: var(--neutral-neutral-1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { type FC } from 'react'
|
|
2
|
+
|
|
3
|
+
import { type SignatureStatus, type SignerStatusItemProps } from './SignerStatusItemProps.types'
|
|
4
|
+
import { CloseIcon } from '../../../../images/componentsSvg/CloseIcon'
|
|
5
|
+
import { Done24px } from '../../../../images/componentsSvg/Done24px'
|
|
6
|
+
import { NewRelease24p } from '../../../../images/componentsSvg/NewRelease24p'
|
|
7
|
+
import { Time24px } from '../../../../images/componentsSvg/Time24px'
|
|
8
|
+
|
|
9
|
+
import { SignerStatusItemStyled } from './SignerStatusItem.styled'
|
|
10
|
+
|
|
11
|
+
const iconByStatus: Record<SignatureStatus, React.ReactNode> = {
|
|
12
|
+
signed: <Done24px />,
|
|
13
|
+
in_progress: <Time24px />,
|
|
14
|
+
declined: <CloseIcon />,
|
|
15
|
+
awaiting: <Time24px />,
|
|
16
|
+
no_response: <NewRelease24p />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const SignerStatusItem: FC<SignerStatusItemProps> = ({ status, children, givenClass = '' }) => {
|
|
20
|
+
return (
|
|
21
|
+
<SignerStatusItemStyled className={`signer-status-item signer-status-item--${status} ${givenClass}`}>
|
|
22
|
+
<span className='signer-status-item__icon' aria-hidden>
|
|
23
|
+
{iconByStatus[status]}
|
|
24
|
+
</span>
|
|
25
|
+
{children}
|
|
26
|
+
</SignerStatusItemStyled>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SignerStatusItem } from './SignerStatusItem';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import Tippy from '@tippyjs/react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
// import 'tippy.js/dist/tippy.css'
|
|
5
|
-
// import './Tooltip.scss'
|
|
6
4
|
const Tooltip = ({ children, position = 'top', inverted, trigger = 'hover', ...rest }) => {
|
|
7
5
|
if (children === undefined)
|
|
8
6
|
return null;
|
|
@@ -3,8 +3,6 @@ import Tippy from '@tippyjs/react'
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
|
|
5
5
|
import { type TooltipProps } from './TooltipProps.types'
|
|
6
|
-
// import 'tippy.js/dist/tippy.css'
|
|
7
|
-
// import './Tooltip.scss'
|
|
8
6
|
|
|
9
7
|
const Tooltip: FC<TooltipProps> = ({ children, position = 'top', inverted, trigger = 'hover', ...rest }) => {
|
|
10
8
|
if (children === undefined) return null
|
package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContent.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '../../atoms/Button';
|
|
3
|
+
import { SignerStatusItem } from '../../atoms/SignerStatusItem';
|
|
4
|
+
import { SignersStatusTooltipContentStyled } from './SignersStatusTooltipContent.styled';
|
|
5
|
+
export const SignersStatusTooltipContent = ({ title = 'Signers Status', signers, manageRequestsLabel, onManageRequestsClick, manageRequestsDataQa = 'manage_requests_button', givenClass = '' }) => {
|
|
6
|
+
return (_jsxs(SignersStatusTooltipContentStyled, { className: `signers-status-tooltip-content ${givenClass}`.trim(), children: [_jsx("h3", { children: title }), _jsx("ul", { className: 'signers-status-tooltip-content__signers', children: signers.map((signer, index) => (_jsx(SignerStatusItem, { status: signer.status, children: signer.children }, `${signer.status}-${index}`))) }), _jsx("div", { className: 'signers-status-tooltip-content__button', children: _jsx(Button, { noLink: true, color: 'tertiary', givenClass: 'underline-button', label: manageRequestsLabel, dataQa: manageRequestsDataQa, onClick: onManageRequestsClick }) })] }));
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SignersStatusTooltipContentStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const SignersStatusTooltipContentStyled = styled.div `
|
|
3
|
+
width: max-content;
|
|
4
|
+
padding: 0.5rem;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 0.5rem;
|
|
8
|
+
font-family: var(--font-sans);
|
|
9
|
+
|
|
10
|
+
.signers-status-tooltip-content__signers {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: 0.5rem;
|
|
14
|
+
padding-bottom: 0.5rem;
|
|
15
|
+
margin: 0;
|
|
16
|
+
list-style: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.signers-status-tooltip-content__button {
|
|
20
|
+
margin-top: 0;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const SignersStatusTooltipContentStyled = styled.div`
|
|
4
|
+
width: max-content;
|
|
5
|
+
padding: 0.5rem;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: 0.5rem;
|
|
9
|
+
font-family: var(--font-sans);
|
|
10
|
+
|
|
11
|
+
.signers-status-tooltip-content__signers {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: 0.5rem;
|
|
15
|
+
padding-bottom: 0.5rem;
|
|
16
|
+
margin: 0;
|
|
17
|
+
list-style: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.signers-status-tooltip-content__button {
|
|
21
|
+
margin-top: 0;
|
|
22
|
+
}
|
|
23
|
+
`
|
package/dist/src/components/molecules/SignersStatusTooltipContent/SignersStatusTooltipContent.tsx
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { type FC } from 'react'
|
|
2
|
+
|
|
3
|
+
import { Button } from '../../atoms/Button'
|
|
4
|
+
import { SignerStatusItem } from '../../atoms/SignerStatusItem'
|
|
5
|
+
import type { SignersStatusTooltipContentProps } from './SignersStatusTooltipContentProps.types'
|
|
6
|
+
import { SignersStatusTooltipContentStyled } from './SignersStatusTooltipContent.styled'
|
|
7
|
+
|
|
8
|
+
export const SignersStatusTooltipContent: FC<SignersStatusTooltipContentProps> = ({
|
|
9
|
+
title = 'Signers Status',
|
|
10
|
+
signers,
|
|
11
|
+
manageRequestsLabel,
|
|
12
|
+
onManageRequestsClick,
|
|
13
|
+
manageRequestsDataQa = 'manage_requests_button',
|
|
14
|
+
givenClass = ''
|
|
15
|
+
}) => {
|
|
16
|
+
return (
|
|
17
|
+
<SignersStatusTooltipContentStyled className={`signers-status-tooltip-content ${givenClass}`.trim()}>
|
|
18
|
+
<h3>{title}</h3>
|
|
19
|
+
<ul className='signers-status-tooltip-content__signers'>
|
|
20
|
+
{signers.map((signer, index) => (
|
|
21
|
+
<SignerStatusItem key={`${signer.status}-${index}`} status={signer.status}>
|
|
22
|
+
{signer.children}
|
|
23
|
+
</SignerStatusItem>
|
|
24
|
+
))}
|
|
25
|
+
</ul>
|
|
26
|
+
<div className='signers-status-tooltip-content__button'>
|
|
27
|
+
<Button
|
|
28
|
+
noLink
|
|
29
|
+
color='tertiary'
|
|
30
|
+
givenClass='underline-button'
|
|
31
|
+
label={manageRequestsLabel}
|
|
32
|
+
dataQa={manageRequestsDataQa}
|
|
33
|
+
onClick={onManageRequestsClick}
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
</SignersStatusTooltipContentStyled>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SignerStatusItemProps } from '../../atoms/SignerStatusItem/SignerStatusItemProps.types';
|
|
2
|
+
export interface SignersStatusTooltipContentProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
signers: SignerStatusItemProps[];
|
|
5
|
+
manageRequestsLabel: string;
|
|
6
|
+
onManageRequestsClick: () => void;
|
|
7
|
+
manageRequestsDataQa?: string;
|
|
8
|
+
givenClass?: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SignerStatusItemProps } from '../../atoms/SignerStatusItem/SignerStatusItemProps.types'
|
|
2
|
+
|
|
3
|
+
export interface SignersStatusTooltipContentProps {
|
|
4
|
+
title?: string
|
|
5
|
+
signers: SignerStatusItemProps[]
|
|
6
|
+
manageRequestsLabel: string
|
|
7
|
+
onManageRequestsClick: () => void
|
|
8
|
+
manageRequestsDataQa?: string
|
|
9
|
+
givenClass?: string
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SignersStatusTooltipContent } from './SignersStatusTooltipContent';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { cleanup, fireEvent, render, waitFor } from '@testing-library/react'
|
|
2
|
-
import React from 'react'
|
|
1
|
+
import React, { cleanup, fireEvent, render, waitFor } from '@testing-library/react'
|
|
3
2
|
|
|
4
3
|
import { Input } from '../Input'
|
|
5
4
|
|
|
@@ -8,38 +7,50 @@ afterEach(cleanup)
|
|
|
8
7
|
const testName = 'name'
|
|
9
8
|
const testValue = 'value'
|
|
10
9
|
|
|
10
|
+
const defaultInputProps = {
|
|
11
|
+
name: '',
|
|
12
|
+
placeholder: '',
|
|
13
|
+
prefix: '',
|
|
14
|
+
value: '',
|
|
15
|
+
type: 'text' as const,
|
|
16
|
+
disabled: false,
|
|
17
|
+
className: '',
|
|
18
|
+
onChange: jest.fn(),
|
|
19
|
+
onClick: jest.fn(),
|
|
20
|
+
onBlur: jest.fn(),
|
|
21
|
+
onKeyDown: jest.fn(),
|
|
22
|
+
onKeyUp: jest.fn(),
|
|
23
|
+
country: ''
|
|
24
|
+
}
|
|
25
|
+
|
|
11
26
|
describe('will return the component', () => {
|
|
12
27
|
test('without props', () => {
|
|
13
|
-
const { getByRole } = render(<Input />)
|
|
28
|
+
const { getByRole } = render(<Input {...defaultInputProps} />)
|
|
14
29
|
expect(getByRole('textbox')).toBeInTheDocument()
|
|
15
30
|
expect(getByRole('textbox')).toHaveAttribute('type', 'text')
|
|
16
31
|
})
|
|
17
32
|
test('of type password: with the eyeIcon rendered', async () => {
|
|
18
|
-
const { container
|
|
33
|
+
const { container } = render(<Input {...defaultInputProps} type='password' value={testValue} />)
|
|
19
34
|
expect(container.firstChild).toHaveAttribute('type', 'password')
|
|
20
35
|
|
|
21
|
-
const
|
|
22
|
-
expect(
|
|
23
|
-
fireEvent.click(
|
|
36
|
+
const toggleButton = container.querySelector('.input-icon-password-button')
|
|
37
|
+
expect(toggleButton).toBeTruthy()
|
|
38
|
+
if (toggleButton) fireEvent.click(toggleButton)
|
|
24
39
|
|
|
25
40
|
await waitFor(() => {
|
|
26
41
|
expect(container.firstChild).toHaveAttribute('type', 'text')
|
|
27
42
|
})
|
|
28
43
|
})
|
|
29
|
-
test('of type password: with the eyeIcon rendered but
|
|
30
|
-
const { container
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const img = getByRole('img')
|
|
34
|
-
expect(img).toHaveClass('input-icon-password')
|
|
35
|
-
fireEvent.click(img)
|
|
44
|
+
test('of type password: with the eyeIcon rendered but without value shows password type initially', () => {
|
|
45
|
+
const { container } = render(<Input {...defaultInputProps} type='password' />)
|
|
46
|
+
const input = container.querySelector('input')
|
|
47
|
+
expect(input).toHaveAttribute('type', 'password')
|
|
36
48
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
})
|
|
49
|
+
const toggleButton = container.querySelector('.input-icon-password-button')
|
|
50
|
+
expect(toggleButton).toBeTruthy()
|
|
40
51
|
})
|
|
41
52
|
test('of type password: with the eyeIcon rendered', () => {
|
|
42
|
-
const { container } = render(<Input name={testName} />)
|
|
53
|
+
const { container } = render(<Input {...defaultInputProps} name={testName} />)
|
|
43
54
|
expect(container.firstChild).toHaveAttribute('data-qa', testName)
|
|
44
55
|
})
|
|
45
56
|
})
|
|
@@ -11,43 +11,50 @@ const testErrorMessage = 'Error message'
|
|
|
11
11
|
const testLabel = 'Label'
|
|
12
12
|
const testNotes = 'Notes'
|
|
13
13
|
|
|
14
|
+
const defaultTextInputProps = {
|
|
15
|
+
onChange: (): void => {},
|
|
16
|
+
country: ''
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
describe('will return the component', () => {
|
|
15
20
|
test('without props', () => {
|
|
16
|
-
const { getByRole, container } = render(<TextInput />)
|
|
21
|
+
const { getByRole, container } = render(<TextInput {...defaultTextInputProps} />)
|
|
17
22
|
expect(container.firstChild).toHaveClass('e-text')
|
|
18
23
|
expect(getByRole('textbox')).toHaveAttribute('type', 'text')
|
|
19
24
|
})
|
|
20
25
|
|
|
21
26
|
test('NumberFormat input if the format prop is passed', () => {
|
|
22
|
-
const { getByRole } = render(<TextInput format={testFormat} />)
|
|
27
|
+
const { getByRole } = render(<TextInput {...defaultTextInputProps} format={testFormat} />)
|
|
23
28
|
expect(getByRole('textbox')).toHaveClass('e-text-input')
|
|
24
29
|
expect(getByRole('textbox')).toHaveAttribute('type', 'text')
|
|
25
30
|
expect(getByRole('textbox')).toHaveAttribute('inputmode', 'numeric')
|
|
26
31
|
})
|
|
27
32
|
|
|
28
33
|
test('with a tooltip', () => {
|
|
29
|
-
const { getByText } = render(<TextInput tooltip={testTooltip} />)
|
|
34
|
+
const { getByText } = render(<TextInput {...defaultTextInputProps} tooltip={testTooltip} />)
|
|
30
35
|
expect(getByText(testTooltip)).toHaveClass('tooltip-form')
|
|
31
36
|
})
|
|
32
37
|
|
|
33
38
|
test('with a error message', () => {
|
|
34
|
-
const { getByText } = render(
|
|
39
|
+
const { getByText } = render(
|
|
40
|
+
<TextInput {...defaultTextInputProps} errorMessage={testErrorMessage} validate={false} />
|
|
41
|
+
)
|
|
35
42
|
expect(getByText(testErrorMessage)).toHaveClass('e-text__error-label')
|
|
36
43
|
})
|
|
37
44
|
|
|
38
45
|
test('with a label', () => {
|
|
39
|
-
const { getByText } = render(<TextInput label={testLabel} />)
|
|
46
|
+
const { getByText } = render(<TextInput {...defaultTextInputProps} label={testLabel} />)
|
|
40
47
|
expect(getByText(testLabel)).toHaveClass('form-group__label')
|
|
41
48
|
})
|
|
42
49
|
|
|
43
50
|
test('with notes', () => {
|
|
44
|
-
const { getByText } = render(<TextInput notes={testNotes} />)
|
|
51
|
+
const { getByText } = render(<TextInput {...defaultTextInputProps} notes={testNotes} />)
|
|
45
52
|
expect(getByText(testNotes)).toHaveClass('e-text__inner__notes')
|
|
46
53
|
})
|
|
47
54
|
|
|
48
55
|
test('should have children', () => {
|
|
49
56
|
const { getByText } = render(
|
|
50
|
-
<TextInput>
|
|
57
|
+
<TextInput {...defaultTextInputProps}>
|
|
51
58
|
<span>test children</span>
|
|
52
59
|
</TextInput>
|
|
53
60
|
)
|
|
@@ -55,10 +62,10 @@ describe('will return the component', () => {
|
|
|
55
62
|
})
|
|
56
63
|
|
|
57
64
|
test('should have id in input and for in label', () => {
|
|
58
|
-
const { getByText, getByLabelText } = render(<TextInput name='cvv' label='CVV' />)
|
|
65
|
+
const { getByText, getByLabelText } = render(<TextInput {...defaultTextInputProps} name='cvv' label='CVV' />)
|
|
59
66
|
|
|
60
67
|
const label = getByText('CVV')
|
|
61
|
-
const input = getByLabelText('CVV')
|
|
68
|
+
const input = getByLabelText('CVV') as HTMLInputElement
|
|
62
69
|
|
|
63
70
|
expect(label).toBeDefined()
|
|
64
71
|
expect(label).toHaveAttribute('for', 'cvv')
|
|
@@ -9,11 +9,11 @@ const testErrorMessage = 'Error message'
|
|
|
9
9
|
|
|
10
10
|
describe('will return null', () => {
|
|
11
11
|
test('if no prop is passed', () => {
|
|
12
|
-
const { container } = render(<TextInputMessage />)
|
|
12
|
+
const { container } = render(<TextInputMessage errorMessage='' validate={false} />)
|
|
13
13
|
expect(container.firstChild).toBe(null)
|
|
14
14
|
})
|
|
15
15
|
test('if errorMessage is passed and validate is true', () => {
|
|
16
|
-
const { container } = render(<TextInputMessage errorMessage={testErrorMessage} />)
|
|
16
|
+
const { container } = render(<TextInputMessage errorMessage={testErrorMessage} validate={true} />)
|
|
17
17
|
expect(container.firstChild).toBe(null)
|
|
18
18
|
})
|
|
19
19
|
})
|
|
@@ -9,7 +9,7 @@ const testTooltip = 'Tooltip'
|
|
|
9
9
|
|
|
10
10
|
describe('will return null', () => {
|
|
11
11
|
test('if no prop is passed', () => {
|
|
12
|
-
const { container } = render(<TextInputTooltip />)
|
|
12
|
+
const { container } = render(<TextInputTooltip tooltip='' />)
|
|
13
13
|
expect(container.firstChild).toBe(null)
|
|
14
14
|
})
|
|
15
15
|
})
|
|
@@ -43,6 +43,7 @@ export * from './RatafiaResultCardList';
|
|
|
43
43
|
export * from './RatafiaResultTabList';
|
|
44
44
|
export * from './SocialLinks';
|
|
45
45
|
export * from './SubscriptionCard';
|
|
46
|
+
export * from './SignersStatusTooltipContent';
|
|
46
47
|
export * from './Snackbar';
|
|
47
48
|
export * from './SearchBar';
|
|
48
49
|
export * from './StepGetForm';
|
|
@@ -43,6 +43,7 @@ export * from './RatafiaResultCardList';
|
|
|
43
43
|
export * from './RatafiaResultTabList';
|
|
44
44
|
export * from './SocialLinks';
|
|
45
45
|
export * from './SubscriptionCard';
|
|
46
|
+
export * from './SignersStatusTooltipContent';
|
|
46
47
|
export * from './Snackbar';
|
|
47
48
|
export * from './SearchBar';
|
|
48
49
|
export * from './StepGetForm';
|
|
@@ -43,6 +43,7 @@ export * from './RatafiaResultCardList'
|
|
|
43
43
|
export * from './RatafiaResultTabList'
|
|
44
44
|
export * from './SocialLinks'
|
|
45
45
|
export * from './SubscriptionCard'
|
|
46
|
+
export * from './SignersStatusTooltipContent'
|
|
46
47
|
export * from './Snackbar'
|
|
47
48
|
export * from './SearchBar'
|
|
48
49
|
export * from './StepGetForm'
|