Skip to content

Commit e588aa3

Browse files
committed
jsdom workaround
- NOTE: EuiDualRange snapshots will just be slightly incorrect until we're on jsdom 15+ 🤷
1 parent cd3a9e2 commit e588aa3

3 files changed

Lines changed: 55 additions & 7 deletions

File tree

src/components/form/field_number/__snapshots__/field_number.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ exports[`EuiFieldNumber is rendered 1`] = `
1717
max="8"
1818
min="1"
1919
name="elastic"
20-
step="1"
20+
step="any"
2121
type="number"
2222
value="1"
2323
/>

src/components/form/field_number/field_number.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ describe('EuiFieldNumber', () => {
3232
name="elastic"
3333
min={1}
3434
max={8}
35-
step={1}
35+
// TODO: Restore this once we upgrade Jest/jsdom to v15+. Right now passing
36+
// a `step` prop always leads to jsdom thinking that validity.valid is false
37+
// @see https://github.com/jsdom/jsdom/issues/2288
38+
// step={1}
3639
value={1}
3740
icon="warning"
3841
onChange={() => {}}

src/components/form/range/__snapshots__/dual_range.test.tsx.snap

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ exports[`EuiDualRange props maxInputProps allows overriding default props 1`] =
224224
class="euiFormControlLayout__childrenWrapper"
225225
>
226226
<input
227-
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput"
227+
aria-invalid="true"
228+
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput euiFormControlLayout--1icons"
228229
max="100"
229230
min="1"
230231
name="undefined-maxValue"
@@ -233,6 +234,14 @@ exports[`EuiDualRange props maxInputProps allows overriding default props 1`] =
233234
type="number"
234235
value="123"
235236
/>
237+
<div
238+
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right euiFormControlLayoutIcons--absolute"
239+
>
240+
<span
241+
color="danger"
242+
data-euiicon-type="warning"
243+
/>
244+
</div>
236245
</div>
237246
</div>
238247
</div>
@@ -318,8 +327,9 @@ exports[`EuiDualRange props maxInputProps applies passed props to max input 1`]
318327
class="euiFormControlLayout__childrenWrapper"
319328
>
320329
<input
330+
aria-invalid="true"
321331
aria-label="Max value"
322-
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput"
332+
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput euiFormControlLayout--1icons"
323333
max="100"
324334
min="1"
325335
name="undefined-maxValue"
@@ -328,6 +338,14 @@ exports[`EuiDualRange props maxInputProps applies passed props to max input 1`]
328338
type="number"
329339
value="8"
330340
/>
341+
<div
342+
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right euiFormControlLayoutIcons--absolute"
343+
>
344+
<span
345+
color="danger"
346+
data-euiicon-type="warning"
347+
/>
348+
</div>
331349
</div>
332350
</div>
333351
</div>
@@ -344,7 +362,8 @@ exports[`EuiDualRange props minInputProps allows overriding default props 1`] =
344362
class="euiFormControlLayout__childrenWrapper"
345363
>
346364
<input
347-
class="euiFieldNumber euiRangeInput euiRangeInput--min emotion-euiRangeInput"
365+
aria-invalid="true"
366+
class="euiFieldNumber euiRangeInput euiRangeInput--min emotion-euiRangeInput euiFormControlLayout--1icons"
348367
max="8"
349368
min="0"
350369
name="undefined-minValue"
@@ -353,6 +372,14 @@ exports[`EuiDualRange props minInputProps allows overriding default props 1`] =
353372
type="number"
354373
value="123"
355374
/>
375+
<div
376+
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right euiFormControlLayoutIcons--absolute"
377+
>
378+
<span
379+
color="danger"
380+
data-euiicon-type="warning"
381+
/>
382+
</div>
356383
</div>
357384
</div>
358385
<div
@@ -413,7 +440,8 @@ exports[`EuiDualRange props minInputProps allows overriding default props 1`] =
413440
class="euiFormControlLayout__childrenWrapper"
414441
>
415442
<input
416-
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput"
443+
aria-invalid="true"
444+
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput euiFormControlLayout--1icons"
417445
max="100"
418446
min="1"
419447
name="undefined-maxValue"
@@ -422,6 +450,14 @@ exports[`EuiDualRange props minInputProps allows overriding default props 1`] =
422450
type="number"
423451
value="8"
424452
/>
453+
<div
454+
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right euiFormControlLayoutIcons--absolute"
455+
>
456+
<span
457+
color="danger"
458+
data-euiicon-type="warning"
459+
/>
460+
</div>
425461
</div>
426462
</div>
427463
</div>
@@ -508,7 +544,8 @@ exports[`EuiDualRange props minInputProps applies passed props to min input 1`]
508544
class="euiFormControlLayout__childrenWrapper"
509545
>
510546
<input
511-
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput"
547+
aria-invalid="true"
548+
class="euiFieldNumber euiRangeInput euiRangeInput--max emotion-euiRangeInput euiFormControlLayout--1icons"
512549
max="100"
513550
min="1"
514551
name="undefined-maxValue"
@@ -517,6 +554,14 @@ exports[`EuiDualRange props minInputProps applies passed props to min input 1`]
517554
type="number"
518555
value="8"
519556
/>
557+
<div
558+
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right euiFormControlLayoutIcons--absolute"
559+
>
560+
<span
561+
color="danger"
562+
data-euiicon-type="warning"
563+
/>
564+
</div>
520565
</div>
521566
</div>
522567
</div>

0 commit comments

Comments
 (0)