Skip to content

Commit ad86810

Browse files
[testing-the-id] docs(changeset): Ensure we can still identify numeric inputs (#2275)
## Summary: This simple PR adds a testId to the InputWithExamples in order to help with cypress testing downstream. Author: SonicScrewdriver Reviewers: mark-fitzgerald Required Reviewers: Approved By: mark-fitzgerald Checks: ✅ 8 checks were successful Pull Request URL: #2275
1 parent 5e28a36 commit ad86810

File tree

7 files changed

+41
-0
lines changed

7 files changed

+41
-0
lines changed

.changeset/heavy-adults-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@khanacademy/perseus": patch
3+
---
4+
5+
Ensure we can still identify numeric inputs

packages/perseus/src/components/text-input.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class TextInput extends React.Component<Props> {
121121
aria-describedby={this.props["aria-describedby"]}
122122
onChange={(value) => this.props.onChange(value)}
123123
placeholder={placeholder}
124+
testId={"input-with-examples"}
124125
onFocus={onFocus}
125126
onBlur={onBlur}
126127
onKeyDown={onKeyDown}

packages/perseus/src/widgets/graded-group-set/__snapshots__/graded-group-set-jipt.test.ts.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ exports[`graded-group-set should render all graded groups 1`] = `
6767
autocomplete="off"
6868
autocorrect="off"
6969
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_1y6ajxo"
70+
data-testid="input-with-examples"
7071
id=":r0:"
7172
tabindex="0"
7273
type="text"
@@ -144,6 +145,7 @@ exports[`graded-group-set should render all graded groups 1`] = `
144145
autocomplete="off"
145146
autocorrect="off"
146147
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_1y6ajxo"
148+
data-testid="input-with-examples"
147149
id=":r3:"
148150
tabindex="0"
149151
type="text"
@@ -221,6 +223,7 @@ exports[`graded-group-set should render all graded groups 1`] = `
221223
autocomplete="off"
222224
autocorrect="off"
223225
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_1y6ajxo"
226+
data-testid="input-with-examples"
224227
id=":r6:"
225228
tabindex="0"
226229
type="text"

packages/perseus/src/widgets/graded-group-set/__snapshots__/graded-group-set.test.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ exports[`graded group widget should snapshot 1`] = `
133133
autocomplete="off"
134134
autocorrect="off"
135135
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_1y6ajxo"
136+
data-testid="input-with-examples"
136137
id=":r0:"
137138
tabindex="0"
138139
type="text"

packages/perseus/src/widgets/group/__snapshots__/group.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,7 @@ exports[`group widget should snapshot: initial render 1`] = `
756756
autocomplete="off"
757757
autocorrect="off"
758758
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_1y6ajxo"
759+
data-testid="input-with-examples"
759760
id=":r0:"
760761
tabindex="0"
761762
type="text"
@@ -812,6 +813,7 @@ exports[`group widget should snapshot: initial render 1`] = `
812813
autocomplete="off"
813814
autocorrect="off"
814815
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_1y6ajxo"
816+
data-testid="input-with-examples"
815817
id=":r3:"
816818
tabindex="0"
817819
type="text"

packages/perseus/src/widgets/matrix/__snapshots__/matrix.test.ts.snap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
9494
autocomplete="off"
9595
autocorrect="off"
9696
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1qo22fw"
97+
data-testid="input-with-examples"
9798
id="input-13"
9899
type="text"
99100
value=""
@@ -110,6 +111,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
110111
autocomplete="off"
111112
autocorrect="off"
112113
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
114+
data-testid="input-with-examples"
113115
id="input-14"
114116
type="text"
115117
value=""
@@ -126,6 +128,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
126128
autocomplete="off"
127129
autocorrect="off"
128130
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
131+
data-testid="input-with-examples"
129132
id="input-15"
130133
type="text"
131134
value=""
@@ -142,6 +145,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
142145
autocomplete="off"
143146
autocorrect="off"
144147
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
148+
data-testid="input-with-examples"
145149
id="input-16"
146150
type="text"
147151
value=""
@@ -162,6 +166,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
162166
autocomplete="off"
163167
autocorrect="off"
164168
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
169+
data-testid="input-with-examples"
165170
id="input-17"
166171
type="text"
167172
value=""
@@ -178,6 +183,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
178183
autocomplete="off"
179184
autocorrect="off"
180185
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
186+
data-testid="input-with-examples"
181187
id="input-18"
182188
type="text"
183189
value=""
@@ -194,6 +200,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
194200
autocomplete="off"
195201
autocorrect="off"
196202
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
203+
data-testid="input-with-examples"
197204
id="input-19"
198205
type="text"
199206
value=""
@@ -210,6 +217,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
210217
autocomplete="off"
211218
autocorrect="off"
212219
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
220+
data-testid="input-with-examples"
213221
id="input-20"
214222
type="text"
215223
value=""
@@ -230,6 +238,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
230238
autocomplete="off"
231239
autocorrect="off"
232240
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
241+
data-testid="input-with-examples"
233242
id="input-21"
234243
type="text"
235244
value=""
@@ -246,6 +255,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
246255
autocomplete="off"
247256
autocorrect="off"
248257
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
258+
data-testid="input-with-examples"
249259
id="input-22"
250260
type="text"
251261
value=""
@@ -262,6 +272,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
262272
autocomplete="off"
263273
autocorrect="off"
264274
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
275+
data-testid="input-with-examples"
265276
id="input-23"
266277
type="text"
267278
value=""
@@ -278,6 +289,7 @@ exports[`matrix widget should snapshot on mobile: first mobile render 1`] = `
278289
autocomplete="off"
279290
autocorrect="off"
280291
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
292+
data-testid="input-with-examples"
281293
id="input-24"
282294
type="text"
283295
value=""
@@ -382,6 +394,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
382394
autocomplete="off"
383395
autocorrect="off"
384396
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1qo22fw"
397+
data-testid="input-with-examples"
385398
id="input-1"
386399
type="text"
387400
value=""
@@ -398,6 +411,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
398411
autocomplete="off"
399412
autocorrect="off"
400413
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
414+
data-testid="input-with-examples"
401415
id="input-2"
402416
type="text"
403417
value=""
@@ -414,6 +428,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
414428
autocomplete="off"
415429
autocorrect="off"
416430
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
431+
data-testid="input-with-examples"
417432
id="input-3"
418433
type="text"
419434
value=""
@@ -430,6 +445,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
430445
autocomplete="off"
431446
autocorrect="off"
432447
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
448+
data-testid="input-with-examples"
433449
id="input-4"
434450
type="text"
435451
value=""
@@ -450,6 +466,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
450466
autocomplete="off"
451467
autocorrect="off"
452468
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
469+
data-testid="input-with-examples"
453470
id="input-5"
454471
type="text"
455472
value=""
@@ -466,6 +483,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
466483
autocomplete="off"
467484
autocorrect="off"
468485
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
486+
data-testid="input-with-examples"
469487
id="input-6"
470488
type="text"
471489
value=""
@@ -482,6 +500,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
482500
autocomplete="off"
483501
autocorrect="off"
484502
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
503+
data-testid="input-with-examples"
485504
id="input-7"
486505
type="text"
487506
value=""
@@ -498,6 +517,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
498517
autocomplete="off"
499518
autocorrect="off"
500519
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
520+
data-testid="input-with-examples"
501521
id="input-8"
502522
type="text"
503523
value=""
@@ -518,6 +538,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
518538
autocomplete="off"
519539
autocorrect="off"
520540
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
541+
data-testid="input-with-examples"
521542
id="input-9"
522543
type="text"
523544
value=""
@@ -534,6 +555,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
534555
autocomplete="off"
535556
autocorrect="off"
536557
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
558+
data-testid="input-with-examples"
537559
id="input-10"
538560
type="text"
539561
value=""
@@ -550,6 +572,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
550572
autocomplete="off"
551573
autocorrect="off"
552574
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
575+
data-testid="input-with-examples"
553576
id="input-11"
554577
type="text"
555578
value=""
@@ -566,6 +589,7 @@ exports[`matrix widget should snapshot: first render 1`] = `
566589
autocomplete="off"
567590
autocorrect="off"
568591
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-input_1simu8f"
592+
data-testid="input-with-examples"
569593
id="input-12"
570594
type="text"
571595
value=""

packages/perseus/src/widgets/numeric-input/__snapshots__/numeric-input.test.ts.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ exports[`numeric-input widget Should render predictably: after interaction 1`] =
100100
autocomplete="off"
101101
autocorrect="off"
102102
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_ylhnsi"
103+
data-testid="input-with-examples"
103104
id=":r6:"
104105
tabindex="0"
105106
type="text"
@@ -152,6 +153,7 @@ exports[`numeric-input widget Should render predictably: first render 1`] = `
152153
autocomplete="off"
153154
autocorrect="off"
154155
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_1y6ajxo"
156+
data-testid="input-with-examples"
155157
id=":r6:"
156158
tabindex="0"
157159
type="text"
@@ -205,6 +207,7 @@ exports[`numeric-input widget Should render tooltip as list when multiple format
205207
autocomplete="off"
206208
autocorrect="off"
207209
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_1y6ajxo"
210+
data-testid="input-with-examples"
208211
id=":rf:"
209212
tabindex="0"
210213
type="text"
@@ -264,6 +267,7 @@ exports[`numeric-input widget Should render tooltip using only correct answer fo
264267
autocomplete="off"
265268
autocorrect="off"
266269
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_1y6ajxo"
270+
data-testid="input-with-examples"
267271
id=":ri:"
268272
tabindex="0"
269273
type="text"
@@ -320,6 +324,7 @@ exports[`numeric-input widget Should render tooltip when format option is given:
320324
autocomplete="off"
321325
autocorrect="off"
322326
class="input_1ck1z8k-o_O-LabelMedium_1rew30o-o_O-default_1tc7wjm-o_O-defaultFocus_lrnqlz-o_O-inputWithExamples_1y6ajxo"
327+
data-testid="input-with-examples"
323328
id=":r9:"
324329
tabindex="0"
325330
type="text"

0 commit comments

Comments
 (0)