Skip to content

Commit 9d8f7b6

Browse files
committed
Fix test
1 parent ce4b5ed commit 9d8f7b6

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

packages/react/src/field/control/useFieldControlValidation.ts

+1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export function useFieldControlValidation() {
166166

167167
if (result !== null) {
168168
nextState.valid = false;
169+
nextState.customError = true;
169170

170171
if (Array.isArray(result)) {
171172
validationErrors = result;

packages/react/src/field/error/FieldError.test.tsx

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ describe('<Field.Error />', () => {
1414
},
1515
}));
1616

17-
it('should set aria-describedby on the control automatically', () => {
18-
render(
17+
it('should set aria-describedby on the control automatically', async () => {
18+
await render(
1919
<Field.Root invalid>
2020
<Field.Control />
2121
<Field.Error forceShow>Message</Field.Error>
@@ -28,8 +28,8 @@ describe('<Field.Error />', () => {
2828
);
2929
});
3030

31-
it('should show error messages by default', () => {
32-
render(
31+
it('should show error messages by default', async () => {
32+
await render(
3333
<Field.Root>
3434
<Field.Control required />
3535
<Field.Error>Message</Field.Error>
@@ -49,8 +49,8 @@ describe('<Field.Error />', () => {
4949
});
5050

5151
describe('prop: match', () => {
52-
it('should only render when `match` matches constraint validation', () => {
53-
render(
52+
it('should only render when `match` matches constraint validation', async () => {
53+
await render(
5454
<Field.Root>
5555
<Field.Control required />
5656
<Field.Error match="valueMissing">Message</Field.Error>
@@ -69,8 +69,8 @@ describe('<Field.Error />', () => {
6969
expect(screen.queryByText('Message')).not.to.equal(null);
7070
});
7171

72-
it('should show custom errors', () => {
73-
render(
72+
it('should show custom errors', async () => {
73+
await render(
7474
<Field.Root validate={() => 'error'}>
7575
<Field.Control />
7676
<Field.Error match="customError">Message</Field.Error>
@@ -89,8 +89,8 @@ describe('<Field.Error />', () => {
8989
});
9090

9191
describe('prop: forceShow', () => {
92-
it('should always render the error message', () => {
93-
render(
92+
it('should always render the error message', async () => {
93+
await render(
9494
<Field.Root>
9595
<Field.Control required />
9696
<Field.Error forceShow>Message</Field.Error>

0 commit comments

Comments
 (0)