Skip to content

Commit

Permalink
jsdom workaround
Browse files Browse the repository at this point in the history
- NOTE: EuiDualRange snapshots will just be slightly incorrect until we're on jsdom 15+ 🤷
  • Loading branch information
cee-chen committed Oct 26, 2023
1 parent cd3a9e2 commit e588aa3
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`EuiFieldNumber is rendered 1`] = `
max="8"
min="1"
name="elastic"
step="1"
step="any"
type="number"
value="1"
/>
Expand Down
5 changes: 4 additions & 1 deletion src/components/form/field_number/field_number.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ describe('EuiFieldNumber', () => {
name="elastic"
min={1}
max={8}
step={1}
// TODO: Restore this once we upgrade Jest/jsdom to v15+. 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={() => {}}
Expand Down
55 changes: 50 additions & 5 deletions src/components/form/range/__snapshots__/dual_range.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ exports[`EuiDualRange props maxInputProps allows overriding default props 1`] =
class="euiFormControlLayout__childrenWrapper"
>
<input
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput"
aria-invalid="true"
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput euiFormControlLayout--1icons"
max="100"
min="1"
name="undefined-maxValue"
Expand All @@ -233,6 +234,14 @@ exports[`EuiDualRange props maxInputProps allows overriding default props 1`] =
type="number"
value="123"
/>
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right euiFormControlLayoutIcons--absolute"
>
<span
color="danger"
data-euiicon-type="warning"
/>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -318,8 +327,9 @@ exports[`EuiDualRange props maxInputProps applies passed props to max input 1`]
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-invalid="true"
aria-label="Max value"
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput"
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput euiFormControlLayout--1icons"
max="100"
min="1"
name="undefined-maxValue"
Expand All @@ -328,6 +338,14 @@ exports[`EuiDualRange props maxInputProps applies passed props to max input 1`]
type="number"
value="8"
/>
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right euiFormControlLayoutIcons--absolute"
>
<span
color="danger"
data-euiicon-type="warning"
/>
</div>
</div>
</div>
</div>
Expand All @@ -344,7 +362,8 @@ exports[`EuiDualRange props minInputProps allows overriding default props 1`] =
class="euiFormControlLayout__childrenWrapper"
>
<input
class="euiFieldNumber euiRangeInput euiRangeInput--min emotion-euiRangeInput"
aria-invalid="true"
class="euiFieldNumber euiRangeInput euiRangeInput--min emotion-euiRangeInput euiFormControlLayout--1icons"
max="8"
min="0"
name="undefined-minValue"
Expand All @@ -353,6 +372,14 @@ exports[`EuiDualRange props minInputProps allows overriding default props 1`] =
type="number"
value="123"
/>
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right euiFormControlLayoutIcons--absolute"
>
<span
color="danger"
data-euiicon-type="warning"
/>
</div>
</div>
</div>
<div
Expand Down Expand Up @@ -413,7 +440,8 @@ exports[`EuiDualRange props minInputProps allows overriding default props 1`] =
class="euiFormControlLayout__childrenWrapper"
>
<input
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput"
aria-invalid="true"
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput euiFormControlLayout--1icons"
max="100"
min="1"
name="undefined-maxValue"
Expand All @@ -422,6 +450,14 @@ exports[`EuiDualRange props minInputProps allows overriding default props 1`] =
type="number"
value="8"
/>
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right euiFormControlLayoutIcons--absolute"
>
<span
color="danger"
data-euiicon-type="warning"
/>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -508,7 +544,8 @@ exports[`EuiDualRange props minInputProps applies passed props to min input 1`]
class="euiFormControlLayout__childrenWrapper"
>
<input
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput"
aria-invalid="true"
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput euiFormControlLayout--1icons"
max="100"
min="1"
name="undefined-maxValue"
Expand All @@ -517,6 +554,14 @@ exports[`EuiDualRange props minInputProps applies passed props to min input 1`]
type="number"
value="8"
/>
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right euiFormControlLayoutIcons--absolute"
>
<span
color="danger"
data-euiicon-type="warning"
/>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit e588aa3

Please sign in to comment.