-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Luis Valgoi
committed
Oct 3, 2020
1 parent
ea58b38
commit 22416da
Showing
3 changed files
with
75 additions
and
1 deletion.
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,26 @@ | ||
import React from 'react'; | ||
|
||
import '@testing-library/jest-dom/extend-expect'; | ||
import { render, screen } from '../../../util/TestSetup'; | ||
|
||
import TextArea from '../TextArea/TextArea'; | ||
|
||
describe('TextArea.js Test Suite', () => { | ||
test('should match snapshot', () => { | ||
const { asFragment } = render( | ||
<TextArea labelText="Text Content" name="description" field={{ name: 'description' }} form={{ touched: { name: 'description' }, errors: { name: 'description' } }} />, | ||
); | ||
|
||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
test('should have rendered with the fieldbase', () => { | ||
render(<TextArea labelText="Text Content" name="description" field={{ name: 'description' }} form={{ touched: { name: 'description' }, errors: { name: 'description' } }} />); | ||
|
||
const fieldbase = screen.getByTestId('fieldbase-wrapper'); | ||
const component = screen.getByTestId('textArea-wrapper'); | ||
|
||
expect(fieldbase).toBeInTheDocument(); | ||
expect(component).toBeInTheDocument(); | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
src/components/Form/TextArea/__snapshots__/TextArea.test.js.snap
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,40 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`TextArea.js Test Suite should match snapshot 1`] = ` | ||
<DocumentFragment> | ||
<div | ||
class="FlexBox-flexBox-0-2-1 FlexBox-flexBoxDirectionColumn-0-2-8 FlexBox-justifyContentStart-0-2-3 FlexBox-alignItemsStretch-0-2-15 FlexBox-flexWrapNoWrap-0-2-17" | ||
data-testid="fieldbase-wrapper" | ||
> | ||
Label { | ||
"_domRefReadyPromise": Promise { | ||
"_deferredResolve": [Function], | ||
}, | ||
"_firePropertyChange": false, | ||
"_fullyConnected": false, | ||
"_inDOM": false, | ||
"_monitoredChildProps": Map {}, | ||
"_shouldInvalidateParent": false, | ||
"_state": Object { | ||
"for": "", | ||
"required": false, | ||
"showColon": false, | ||
"wrap": true, | ||
}, | ||
"_upToDate": false, | ||
} | ||
<ui5-textarea | ||
data-testid="textArea-wrapper" | ||
growing-max-lines="0" | ||
name="description" | ||
rows="0" | ||
style="margin-bottom: 1rem;" | ||
value-state="None" | ||
> | ||
<span | ||
slot="valueStateMessage" | ||
/> | ||
</ui5-textarea> | ||
</div> | ||
</DocumentFragment> | ||
`; |