Skip to content

Commit

Permalink
Update demo link for fixeDecimal scale
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yadav committed Mar 5, 2023
1 parent b6459d4 commit 11af4c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion documentation/v5/docs/numeric_format.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ import { NumericFormat } from 'react-number-format';
<summary>
Demo
</summary>
<iframe src="https://codesandbox.io/embed/fixeddecimalscale-demo-kwbnev?fontsize=14&hidenavigation=1&theme=dark&view=preview"
<iframe src="https://codesandbox.io/s/fixeddecimalscale-demo-3jnvz7?fontsize=14&hidenavigation=1&theme=dark&view=preview"
className='csb'
title="allowNegative-demo"
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
Expand Down
18 changes: 9 additions & 9 deletions test/library/input.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
getInputValue,
render,
wait,
simulateNativeKeyInput
simulateNativeKeyInput,
} from '../test_util';
import PatternFormat, { usePatternFormat } from '../../src/pattern_format';
import NumberFormatBase from '../../src/number_format_base';
Expand Down Expand Up @@ -287,19 +287,19 @@ describe('NumberFormat as input', () => {
simulateKeyInput(wrapper.find('input'), '8', 0, format.length);
expect(getInputValue(wrapper)).toEqual('+1 (8__) ___ _ __ US');
});

it('should give proper value when format character has number #652', () => {
//https://github.com/s-yadav/react-number-format/issues/652#issuecomment-1278200770
const spy = jasmine.createSpy();
const wrapper = mount(<PatternFormat format="13###" mask="_" onValueChange={spy} />);
const wrapper = mount(<PatternFormat format="13###" mask="_" onValueChange={spy} />);
simulateKeyInput(wrapper.find('input'), '3', 0);
simulateKeyInput(wrapper.find('input'), '4', 3);
expect(spy.calls.argsFor(1)[0]).toEqual({
formattedValue: '1334_',
value: '34',
floatValue: 34,
});
})
});

it('should not allow replacing all characters with number when formatting is present for NumericFormats', () => {
//check for numeric input
Expand Down Expand Up @@ -558,7 +558,7 @@ describe('NumberFormat as input', () => {

it('should not give wrong value, when user enter more number than the given hash in PatternFormat #712', async () => {
const Component = () => {
const [value, setValue] = useState("1232345124");
const [value, setValue] = useState('1232345124');
return (
<div>
<PatternFormat
Expand All @@ -572,17 +572,17 @@ describe('NumberFormat as input', () => {
/>
<span data-testid="value">{value}</span>
</div>
)
}
);
};

const {input, view} = await render(<Component />);
const { input, view } = await render(<Component />);
simulateNativeKeyInput(input, '1', 1, 1);
await wait(100);

expect(input.value).toEqual('(112) 3234 512');
const value = await view.getByTestId('value');
expect(value.innerText).toEqual('1123234512');
})
});

describe('Test masking', () => {
it('should allow mask as string', () => {
Expand Down

0 comments on commit 11af4c5

Please sign in to comment.