Skip to content

Commit d0adbdd

Browse files
committed
Give up on making constraintText selector "backwards-compatible".
1 parent 8a3eeb8 commit d0adbdd

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33462,6 +33462,19 @@ To find a specific row use the \`findRow(n)\` function as chaining \`findRows().
3346233462
},
3346333463
{
3346433464
"methods": [
33465+
{
33466+
"name": "findCharacterCount",
33467+
"parameters": [],
33468+
"returnType": {
33469+
"isNullable": true,
33470+
"name": "ElementWrapper",
33471+
"typeArguments": [
33472+
{
33473+
"name": "HTMLElement",
33474+
},
33475+
],
33476+
},
33477+
},
3346533478
{
3346633479
"name": "findConstraint",
3346733480
"parameters": [],
@@ -44499,6 +44512,14 @@ To find a specific row use the \`findRow(n)\` function as chaining \`findRows().
4449944512
},
4450044513
{
4450144514
"methods": [
44515+
{
44516+
"name": "findCharacterCount",
44517+
"parameters": [],
44518+
"returnType": {
44519+
"isNullable": false,
44520+
"name": "ElementWrapper",
44521+
},
44522+
},
4450244523
{
4450344524
"name": "findConstraint",
4450444525
"parameters": [],

src/file-upload/internal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import InternalFileDropzone from '../file-dropzone/internal';
1313
import { useFilesDragging } from '../file-dropzone/use-files-dragging';
1414
import InternalFileInput from '../file-input/internal';
1515
import InternalFileTokenGroup from '../file-token-group/internal';
16-
import { ConstraintText, FormFieldError, FormFieldWarning } from '../form-field/internal';
16+
import { ConstraintTextArea, FormFieldError, FormFieldWarning } from '../form-field/internal';
1717
import { useInternalI18n } from '../i18n/context';
1818
import { getBaseProps } from '../internal/base-component';
1919
import { fireNonCancelableEvent } from '../internal/events';
@@ -167,9 +167,9 @@ function InternalFileUpload(
167167
</FormFieldWarning>
168168
)}
169169
{constraintText && (
170-
<ConstraintText id={constraintTextId} hasValidationText={!!errorText || !!warningText}>
170+
<ConstraintTextArea id={constraintTextId} hasValidationText={!!errorText || !!warningText}>
171171
{constraintText}
172-
</ConstraintText>
172+
</ConstraintTextArea>
173173
)}
174174
</div>
175175
)}

src/form-field/internal.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export function FormFieldWarning({ id, children, warningIconAriaLabel }: FormFie
9292
);
9393
}
9494

95-
export function ConstraintText({
95+
export function ConstraintTextArea({
9696
id,
9797
hasValidationText,
9898
children,
@@ -291,22 +291,22 @@ export default function InternalFormField({
291291
</FormFieldWarning>
292292
)}
293293
{(constraintText || characterCountText) && (
294-
<ConstraintText hasValidationText={!!errorText || !!warningText}>
294+
<ConstraintTextArea hasValidationText={!!errorText || !!warningText}>
295295
{constraintText && (
296296
<span id={slotIds.constraint} className={testStyles.constraint}>
297297
{constraintText}
298298
</span>
299299
)}
300300
{characterCountText && (
301301
<>
302-
{' '}
302+
{!!constraintText && ' '}
303303
<span className={testStyles['character-count']} aria-hidden={true}>
304304
{characterCountText}
305305
</span>
306306
<ScreenreaderOnly id={slotIds.characterCount}>{debouncedCharacterCountText}</ScreenreaderOnly>
307307
</>
308308
)}
309-
</ConstraintText>
309+
</ConstraintTextArea>
310310
)}
311311
</div>
312312
)}

src/test-utils/dom/form-field/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ export default class FormFieldWrapper extends ComponentWrapper<HTMLElement> {
2121
}
2222

2323
findConstraint(): ElementWrapper | null {
24-
return this.find(
25-
`:scope > .${styles.hints} .${styles.constraint}, :scope > .${styles.hints} .${testStyles.constraint}`
26-
);
24+
return this.find(`:scope > .${styles.hints} .${testStyles.constraint}`);
2725
}
2826

2927
findCharacterCount(): ElementWrapper | null {

0 commit comments

Comments
 (0)