This file contains hidden or 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
import { shallow } from 'enzyme'; | |
import * as React from 'react'; | |
import { ExerciseDetail } from './'; | |
describe('ExerciseDetail', () => { | |
it('should display the warning', () => { | |
const anExercise: Exercise = { | |
warning: 'irrelevant warning message', | |
tags: ['irrelevant tag', 'irrelevant tag'], | |
name: 'irrelevant name', |
This file contains hidden or 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
import * as React from 'react'; | |
import './ExerciseDetail.scss'; | |
// ... more irrelevant imports for this example | |
interface ExerciseDetailsProp { | |
exercise: Exercise | |
} | |
export const ExerciseDetail: React.FC<ExerciseDetailsProp> = ({exercise}) => ( | |
<div className="ExerciseDetail"> |
This file contains hidden or 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
interface Character { | |
optionalProerty? : string | |
} |
This file contains hidden or 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
interface CarrouselProps { | |
children: ReactNode[] | |
} | |
class Carrousel extends React.PureComponent<CarrouselProps> { | |
public render () { | |
return ( | |
<div> | |
{this.props.children.map(child => <div>{child}</div>)} | |
</div>); | |
} |
This file contains hidden or 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
class Carrousel extends React.PureComponent<{}> { | |
public render () { | |
return ( | |
<div> | |
{this.props.children.map(child => <div>{child}</div>)} | |
</div>); | |
} | |
}; |
This file contains hidden or 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
const MyComponent: React.SFC<{}> = () => ( | |
<Carrousel> | |
<img src='image1.png' alt='image 1'/> | |
<img src='image2.png' alt='image 2'/> | |
<img src='image3.png' alt='image 3'/> | |
</Carrousel>); |
This file contains hidden or 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
// ts code: | |
const id: characterId = 'irrelevant'; | |
const character: Hero = getCharacterBy(id); | |
// character.run(); -> Heros never run. | |
character.saveTheDay(); |
This file contains hidden or 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
// js code: | |
const id = 'irrelevant' | |
const character = getCharacterBy(id); | |
character.run(); |
This file contains hidden or 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
import React from 'react'; | |
import { StyleSheet, Text, View, Button, TextInput } from 'react-native'; | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { |
This file contains hidden or 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
import React from 'react'; | |
import App from './App'; | |
import renderer from 'react-test-renderer'; | |
import Adapter from 'enzyme-adapter-react-16' | |
import { shallow, configure } from 'enzyme'; | |
configure({ adapter: new Adapter() }); | |
it('renders without crashing', () => { |