File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
sample/__tests__/components Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2017, Globo.com (https://github.com/globocom)
3+ *
4+ * License: MIT
5+ */
6+
7+ /* eslint-env jest */
8+ import { defaultStylesForTest } from '../../../src/components/defaultStyles' ;
9+
10+ describe ( 'defaultStyles' , ( ) => {
11+ describe ( 'returns the style for each platform' , ( ) => {
12+ it ( 'android' , ( ) => {
13+ expect ( defaultStylesForTest ( 'android' ) [ 'code-block' ] . fontFamily ) . toBe ( 'monospace' ) ;
14+ } ) ;
15+
16+ it ( 'ios' , ( ) => {
17+ expect ( defaultStylesForTest ( 'ios' ) [ 'code-block' ] . fontFamily ) . toBe ( 'Courier New' ) ;
18+ } ) ;
19+ } ) ;
20+ } ) ;
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import {
1111 Platform ,
1212} from 'react-native' ;
1313
14- const defaultStyles = StyleSheet . create ( {
14+ const defaultStyles = ( PlatformOS : string ) : Object => StyleSheet . create ( {
1515 paragraph : {
1616 fontSize : 14 ,
1717 fontWeight : 'normal' ,
@@ -66,7 +66,7 @@ const defaultStyles = StyleSheet.create({
6666 } ,
6767 'code-block' : {
6868 backgroundColor : '#cecece' ,
69- fontFamily : Platform . OS === 'android' ? 'monospace' : 'Courier New' ,
69+ fontFamily : PlatformOS === 'android' ? 'monospace' : 'Courier New' ,
7070 padding : 16 ,
7171 } ,
7272 blockquote : {
@@ -77,4 +77,5 @@ const defaultStyles = StyleSheet.create({
7777 } ,
7878} ) ;
7979
80- export default defaultStyles ;
80+ export { defaultStyles as defaultStylesForTest } ;
81+ export default defaultStyles ( Platform . OS ) ;
You can’t perform that action at this time.
0 commit comments