forked from adobe/react-spectrum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(RAC): Allow passing data attributes to FieldError (adobe#6895)
* Allow passing data attributes to FieldError * Update FieldError.tsx just fixing some lint, not sure how it passed --------- Co-authored-by: Robert Snow <[email protected]> Co-authored-by: Reid Barber <[email protected]>
- Loading branch information
1 parent
7336849
commit 3aa13af
Showing
2 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {FieldError} from '../src/FieldError'; | ||
import {Input} from '../src/Input'; | ||
import {Label} from '../src/Label'; | ||
import React from 'react'; | ||
import {render} from '@react-spectrum/test-utils-internal'; | ||
import {TextField} from '../src/TextField'; | ||
|
||
describe('FieldError', function () { | ||
it('supports data attributes passed as props', async () => { | ||
const TEST_ID = 'testid'; | ||
|
||
const {getByTestId} = render( | ||
<TextField isInvalid> | ||
<Label>Email</Label> | ||
<Input /> | ||
<FieldError data-testid={TEST_ID}>An error</FieldError> | ||
</TextField> | ||
); | ||
|
||
const element = getByTestId(TEST_ID); | ||
expect(element).toHaveTextContent('An error'); | ||
}); | ||
}); |