Skip to content

Commit 5b09edc

Browse files
author
Hector Arce De Las Heras
committed
New RegExp on summary type prop on input component
1 parent 2a72e8d commit 5b09edc

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

src/components/input/stories/argtypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ export const argtypes = (variants: IThemeObjectVariants, themeSelected: string):
396396
control: { type: 'text' },
397397
table: {
398398
type: {
399-
summary: 'string',
399+
summary: 'string | RegExp',
400400
},
401401
category: CATEGORY_CONTROL.MODIFIERS,
402402
},

src/components/input/types/input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ export type IInputUnControlled<V = undefined extends string ? unknown : string>
411411
value?: string | number;
412412
errorExecution?: ERROR_EXECUTION;
413413
keyValidation?: string;
414-
regex?: string;
414+
regex?: string | RegExp;
415415
// functions
416416
onInternalErrors?: (errors: string[]) => void;
417417
onError?: (error: boolean) => void;

src/components/inputCurrency/helpers/__tests__/truncatedValue.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { truncatedValue } from '../truncatedValue';
22

33
describe('Utils truncatedValue', () => {
4+
it('truncatedValue default 1', () => {
5+
expect(truncatedValue('10000.00', 0)).toBe('10000');
6+
});
47
it('truncatedValue default', () => {
58
expect(truncatedValue('10000', 3)).toBe('10000');
69
});

src/components/inputPassword/__tests__/inputPassword.test.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { fireEvent } from '@testing-library/react';
1+
import { fireEvent, screen } from '@testing-library/react';
22
import * as React from 'react';
33

44
import { axe } from 'jest-axe';
55

6+
import { InputTypeType } from '@/components/input/types';
67
import { renderProvider } from '@/tests/renderProvider/renderProvider.utility';
78

89
import { InputPassword } from '../inputPassword';
@@ -32,6 +33,18 @@ describe('New Input Password Component', () => {
3233
expect(results).toHaveNoViolations();
3334
});
3435

36+
it('Should get activeIcon', async () => {
37+
const { container } = renderProvider(
38+
<InputPassword {...mockProps} type={InputTypeType.NUMBER} />
39+
);
40+
41+
expect(screen.getByLabelText('icon show password alt text')).toBeInTheDocument();
42+
43+
const results = await axe(container);
44+
expect(container).toHTMLValidate();
45+
expect(results).toHaveNoViolations();
46+
});
47+
3548
it('Should render InputPassword component with default input', async () => {
3649
const onChange = jest.fn();
3750
const { container, getByTestId } = renderProvider(

0 commit comments

Comments
 (0)