diff --git a/src/components/form/field_number/__snapshots__/field_number.test.tsx.snap b/src/components/form/field_number/__snapshots__/field_number.test.tsx.snap index a069f5900a2..e097f199fdf 100644 --- a/src/components/form/field_number/__snapshots__/field_number.test.tsx.snap +++ b/src/components/form/field_number/__snapshots__/field_number.test.tsx.snap @@ -17,7 +17,7 @@ exports[`EuiFieldNumber is rendered 1`] = ` max="8" min="1" name="elastic" - step="1" + step="any" type="number" value="1" /> diff --git a/src/components/form/field_number/field_number.test.tsx b/src/components/form/field_number/field_number.test.tsx index 5ce42c0715e..335e9795471 100644 --- a/src/components/form/field_number/field_number.test.tsx +++ b/src/components/form/field_number/field_number.test.tsx @@ -32,7 +32,10 @@ describe('EuiFieldNumber', () => { name="elastic" min={1} max={8} - step={1} + // TODO: Restore this once we upgrade Jest/jsdom to latest. Right now passing + // a `step` prop always leads to jsdom thinking that validity.valid is false + // @see https://github.com/jsdom/jsdom/issues/2288 + // step={1} value={1} icon="warning" onChange={() => {}} diff --git a/src/components/form/range/__snapshots__/dual_range.test.tsx.snap b/src/components/form/range/__snapshots__/dual_range.test.tsx.snap index 388ee782b74..9e79ba42344 100644 --- a/src/components/form/range/__snapshots__/dual_range.test.tsx.snap +++ b/src/components/form/range/__snapshots__/dual_range.test.tsx.snap @@ -229,9 +229,9 @@ exports[`EuiDualRange props maxInputProps allows overriding default props 1`] = min="1" name="undefined-maxValue" step="1" - style="inline-size: calc(12px + 3ch + 2em + 22px);" + style="inline-size: calc(12px + 2ch + 2em + 0px);" type="number" - value="123" + value="23" /> @@ -324,7 +324,7 @@ exports[`EuiDualRange props maxInputProps applies passed props to max input 1`] min="1" name="undefined-maxValue" step="1" - style="inline-size: calc(12px + 1ch + 2em + 22px);" + style="inline-size: calc(12px + 1ch + 2em + 0px);" type="number" value="8" /> @@ -349,9 +349,9 @@ exports[`EuiDualRange props minInputProps allows overriding default props 1`] = min="0" name="undefined-minValue" step="1" - style="inline-size: calc(12px + 2ch + 2em + 22px);" + style="inline-size: calc(12px + 2ch + 2em + 0px);" type="number" - value="123" + value="12" /> @@ -418,7 +418,7 @@ exports[`EuiDualRange props minInputProps allows overriding default props 1`] = min="1" name="undefined-maxValue" step="1" - style="inline-size: calc(12px + 1ch + 2em + 22px);" + style="inline-size: calc(12px + 1ch + 2em + 0px);" type="number" value="8" /> @@ -513,7 +513,7 @@ exports[`EuiDualRange props minInputProps applies passed props to min input 1`] min="1" name="undefined-maxValue" step="1" - style="inline-size: calc(12px + 1ch + 2em + 22px);" + style="inline-size: calc(12px + 1ch + 2em + 0px);" type="number" value="8" /> diff --git a/src/components/form/range/dual_range.test.tsx b/src/components/form/range/dual_range.test.tsx index 62c6e1cc53e..392ce6dee87 100644 --- a/src/components/form/range/dual_range.test.tsx +++ b/src/components/form/range/dual_range.test.tsx @@ -47,6 +47,14 @@ describe('EuiDualRange', () => { } ); + // TODO: jsdom is, for some reason, incorrectly setting native `valid` state to + // false anytime a `step` is passed. We're temporarily overriding/mocking this + // value until we can upgrade Jest/Jsdom and see if it fixes itself + Object.defineProperty(HTMLInputElement.prototype, 'validity', { + configurable: true, + value: { valid: true }, + }); + it('renders', () => { const { container } = render( @@ -293,7 +301,7 @@ describe('EuiDualRange', () => { it('allows overriding default props', () => { const { container } = render( - + ); expect(container.firstChild).toMatchSnapshot(); @@ -315,7 +323,7 @@ describe('EuiDualRange', () => { it('allows overriding default props', () => { const { container } = render( - + ); expect(container.firstChild).toMatchSnapshot();