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
| describe('AddTodo component', () => { | |
| ... | |
| it('Should have one input', () => { | |
| const component = shallow(<AddTodo />); | |
| expect(component.find('.todo-input').length).toEqual(1); | |
| }); | |
| }); |
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'; | |
| const AddTodo = () => ( | |
| <div> | |
| <input className="todo-input" /> | |
| </div> | |
| ); | |
| export default AddTodo; |
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
| /* global expect, it, describe */ | |
| describe('AddTodo component', () => { | |
| ... | |
| describe('Add todo button', () => { | |
| it('Should exist', () => { | |
| const component = shallow(<AddTodo />); | |
| expect(component.find('.todo-submit').length).toEqual(1); | |
| }); |
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 AddTodo from './components/addTodo/'; | |
| const App = () => ( | |
| <div> | |
| <h1>Todo list</h1> | |
| <AddTodo /> | |
| </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
| import React from 'react'; | |
| const AddTodo = () => ( | |
| <div> | |
| <form> | |
| <input className="todo-input" /> | |
| <button type="submit" className="todo-submit"> | |
| Add Todo | |
| </button> |
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
| /* global expect, it, describe, jest */ | |
| ... | |
| import { shallow, mount } from 'enzyme'; | |
| ... | |
| describe('AddTodo component', () => { | |
| ... | |
| describe('Add todo button', () => { |
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 PropTypes from 'prop-types'; | |
| const AddTodo = ({ submitTodo }) => { | |
| let input; | |
| return ( | |
| <div> | |
| <form | |
| onSubmit={(event) => { |
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
| /* global expect, it, describe, jest, beforeEach */ | |
| import React from 'react'; | |
| import { shallow, mount } from 'enzyme'; | |
| import AddTodo from '.'; | |
| describe('AddTodo component', () => { | |
| let component; | |
| const submitMock = jest.fn(); |
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
| /* global it, expect */ | |
| import React from 'react'; | |
| import { shallow } from 'enzyme'; | |
| import App from './App'; | |
| it('App renders without crashing', () => { | |
| const component = shallow(<App submitTodo={() => {}} />); | |
| expect(component.exists()).toEqual(true); | |
| }); |
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 AddTodo from './components/addTodo/'; | |
| const App = () => ( | |
| <div> | |
| <h1>Todo list</h1> | |
| <AddTodo submitTodo={() => {}} /> | |
| </div> | |
| ); |