Skip to content

Commit 5623ecf

Browse files
author
Alexis Córdova
authored
chore(form-element): Update Examples, Add Missing Examples to Storybook (#4748)
1 parent 5f374e3 commit 5623ecf

File tree

11 files changed

+404
-343
lines changed

11 files changed

+404
-343
lines changed

ui/components/form-element/__tests__/__snapshots__/snapshot.spec.js.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ exports[`Compound Form Element render deprecated compound form element 1`] = `
144144
>
145145
<label
146146
className="slds-form-element__label"
147-
htmlFor="location-latitude-01"
147+
htmlFor="location-latitude-02"
148148
>
149149
Latitude
150150
</label>
@@ -154,7 +154,7 @@ exports[`Compound Form Element render deprecated compound form element 1`] = `
154154
<input
155155
className="slds-input"
156156
defaultValue="54.293"
157-
id="location-latitude-01"
157+
id="location-latitude-02"
158158
type="text"
159159
/>
160160
</div>
@@ -188,7 +188,7 @@ exports[`Compound Form Element renders address compound form element 1`] = `
188188
>
189189
<label
190190
className="slds-form-element__label"
191-
htmlFor="form-element-id-04"
191+
htmlFor="form-element-id-01"
192192
>
193193
Billing Street
194194
</label>
@@ -198,7 +198,7 @@ exports[`Compound Form Element renders address compound form element 1`] = `
198198
<textarea
199199
className="slds-textarea"
200200
defaultValue="525 S. Lexington Ave"
201-
id="form-element-id-04"
201+
id="form-element-id-01"
202202
placeholder="Placeholder text…"
203203
required={true}
204204
/>
@@ -217,7 +217,7 @@ exports[`Compound Form Element renders address compound form element 1`] = `
217217
>
218218
<label
219219
className="slds-form-element__label"
220-
htmlFor="form-element-id-05"
220+
htmlFor="form-element-id-02"
221221
>
222222
Billing City
223223
</label>
@@ -227,7 +227,7 @@ exports[`Compound Form Element renders address compound form element 1`] = `
227227
<input
228228
className="slds-input"
229229
defaultValue="Burlington"
230-
id="form-element-id-05"
230+
id="form-element-id-02"
231231
required={true}
232232
type="text"
233233
/>
@@ -242,7 +242,7 @@ exports[`Compound Form Element renders address compound form element 1`] = `
242242
>
243243
<label
244244
className="slds-form-element__label"
245-
htmlFor="form-element-id-06"
245+
htmlFor="form-element-id-03"
246246
>
247247
Billing State/Province
248248
</label>
@@ -252,7 +252,7 @@ exports[`Compound Form Element renders address compound form element 1`] = `
252252
<input
253253
className="slds-input"
254254
defaultValue="NC"
255-
id="form-element-id-06"
255+
id="form-element-id-03"
256256
required={true}
257257
type="text"
258258
/>
@@ -271,7 +271,7 @@ exports[`Compound Form Element renders address compound form element 1`] = `
271271
>
272272
<label
273273
className="slds-form-element__label"
274-
htmlFor="form-element-id-07"
274+
htmlFor="form-element-id-04"
275275
>
276276
Billing Zip/Postal Code
277277
</label>
@@ -281,7 +281,7 @@ exports[`Compound Form Element renders address compound form element 1`] = `
281281
<input
282282
className="slds-input"
283283
defaultValue="27215"
284-
id="form-element-id-07"
284+
id="form-element-id-04"
285285
required={true}
286286
type="text"
287287
/>
@@ -296,7 +296,7 @@ exports[`Compound Form Element renders address compound form element 1`] = `
296296
>
297297
<label
298298
className="slds-form-element__label"
299-
htmlFor="form-element-id-08"
299+
htmlFor="form-element-id-05"
300300
>
301301
Billing Country
302302
</label>
@@ -306,7 +306,7 @@ exports[`Compound Form Element renders address compound form element 1`] = `
306306
<input
307307
className="slds-input"
308308
defaultValue="USA"
309-
id="form-element-id-08"
309+
id="form-element-id-05"
310310
required={true}
311311
type="text"
312312
/>

ui/components/form-element/__tests__/snapshot.spec.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,13 @@ describe('Horizontal Form Element', () => {
244244

245245
describe('Compound Form Element', () => {
246246
it('renders simple compound form element', () =>
247-
matchesMarkup(CompoundExamples.default));
247+
matchesMarkup(
248+
getDisplayElementById(CompoundExamples.default)
249+
));
248250
it('renders address compound form element', () =>
249-
matchesMarkup(AddressExamples.default));
251+
matchesMarkup(
252+
getDisplayElementById(AddressExamples.default)
253+
));
250254
it('render compound form element wrapper', () =>
251255
matchesMarkup(<CompoundFormElement>content</CompoundFormElement>));
252256
it('render compound form element wrapper with legend', () =>

ui/components/form-element/_doc.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* Every field requires an associated, non-empty `<label>` element. The label should have a `for` attribute that references the `id` of the field. For example, `<label for="emailAddress">Enter email address:</label>` and `<input id="emailAddress">`. This association ensures that assistive technology informs users what information to enter where.
1616
*
17-
* If the field is required, the `<input>` element should have the HTML attribute `required` or `required=""`. Similarily, if it is disabled, it should have the `disabled` or `disabled=""` attribute. Do not use true/false values inside the `required` or `disabled` because the mere presence of these attributes signifies the field is required or disabled.
17+
* If the field is required, the `<input>` element should have the HTML attribute `required` or `required=""`. Similarly, if it is disabled, it should have the `disabled` or `disabled=""` attribute. Do not use true/false values inside the `required` or `disabled` because the mere presence of these attributes signifies the field is required or disabled.
1818
*
1919
* If the field is invalid and displays an error message, the `<input>` element should have an `aria-describedby` attribute that references the `id` of the error message. This configuration allows screen readers to read the associated error message when the invalid field is focused.
2020
*

0 commit comments

Comments
 (0)