-
Notifications
You must be signed in to change notification settings - Fork 11
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
Showing
4 changed files
with
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'react-native' | ||
import React from 'react' | ||
import { render, fireEvent } from '@testing-library/react-native' | ||
|
||
import AsciiToggle from './AsciiToggle' | ||
|
||
describe( '<AsciiToggle />', () => { | ||
it( 'should fire onPress event', () => { | ||
const onPressMock = jest.fn() | ||
|
||
const { getByTestId } = render( | ||
<AsciiToggle onPress={onPressMock} testID="ascii-toggle" />, | ||
) | ||
|
||
fireEvent.press( getByTestId( 'ascii-toggle' ) ) | ||
|
||
expect( onPressMock ).toHaveBeenCalled() | ||
} ) | ||
} ) |
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,27 @@ | ||
import React from 'react' | ||
import { Text, Pressable, StyleSheet, PressableProps } from 'react-native' | ||
|
||
const styles = StyleSheet.create( { | ||
asciiToggle: { | ||
padding: 8, | ||
borderRadius: 10, | ||
shadowOpacity: 0.2, | ||
flexDirection: 'row', | ||
shadowOffset: { width: 0, height: 2 }, | ||
backgroundColor: 'rgb(255,255,255)', | ||
}, | ||
gurmukhi: { | ||
fontFamily: 'OpenGurbaniAkhar-Black', | ||
}, | ||
} ) | ||
|
||
type AsciiToggleProps = Omit<PressableProps, 'style'> | ||
|
||
const AsciiToggle = ( { ...props }:AsciiToggleProps ) => ( | ||
<Pressable style={styles.asciiToggle} {...props}> | ||
<Text style={styles.gurmukhi}>A</Text> | ||
<Text>A</Text> | ||
</Pressable> | ||
) | ||
|
||
export default AsciiToggle |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as SearchBar } from './Bar' | ||
export { default as SearchFilter } from './Filter' | ||
export { default as AsciiToggle } from './AsciiToggle' |
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