-
Notifications
You must be signed in to change notification settings - Fork 957
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components): text - improve ts definitions for props
- Loading branch information
Artur Yorsh
committed
Feb 28, 2020
1 parent
2d64770
commit da7d51f
Showing
2 changed files
with
62 additions
and
7 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,50 @@ | ||
/** | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from 'react-native-testing-library'; | ||
import { | ||
light, | ||
mapping, | ||
} from '@eva-design/eva'; | ||
import { ApplicationProvider } from '../../theme'; | ||
import { | ||
Text, | ||
TextProps, | ||
} from './text.component'; | ||
|
||
describe('@text: component checks', () => { | ||
|
||
const TestText = (props?: TextProps) => ( | ||
<ApplicationProvider | ||
mapping={mapping} | ||
theme={light}> | ||
<Text {...props}/> | ||
</ApplicationProvider> | ||
); | ||
|
||
it('should render text passed to children', () => { | ||
const component = render( | ||
<TestText>I love Babel</TestText>, | ||
); | ||
|
||
const text = component.getByText('I love Babel'); | ||
|
||
expect(text).toBeTruthy(); | ||
}); | ||
|
||
it('should render component passed to children', () => { | ||
const component = render( | ||
<TestText> | ||
<Text>I love Babel</Text> | ||
</TestText>, | ||
); | ||
|
||
const textAsComponent = component.getByText('I love Babel'); | ||
|
||
expect(textAsComponent).toBeTruthy(); | ||
}); | ||
}); |