From 208fe0a67a906902e8de6503f045760957b65cc1 Mon Sep 17 00:00:00 2001 From: Jaewoo Maeng Date: Fri, 9 Oct 2020 18:36:29 +0900 Subject: [PATCH 1/2] except for todocal --- backend/db.sqlite3 | Bin 139264 -> 143360 bytes src/components/Calendar/Calendar.js | 2 +- src/components/Calendar/Calendar.test.js | 59 + src/containers/TodoList/NewTodo/NewTodo.js | 6 +- .../TodoList/NewTodo/NewTodo.test.js | 34 +- src/store/actions/todo.js | 1 - yarn.lock | 11087 ++++++++++++++++ 7 files changed, 11185 insertions(+), 4 deletions(-) create mode 100644 src/components/Calendar/Calendar.test.js create mode 100644 yarn.lock diff --git a/backend/db.sqlite3 b/backend/db.sqlite3 index 6265512928054730f8b4b68b150b9ac9a105f3d9..40a02f5af225730886e965616426c2a70920f0dc 100644 GIT binary patch delta 868 zcmZvbUr19?7{Kq@z2pAL?QCvysf=B>FfyIzZm63EVN{fuN+r_M^|*6$qq&XU>(ZCp z5+Vp<;==_WB76&aa2gGY!k6B95c08y!XSbk3L<>yp>t;pB|px0`1pR`zjF?!v@MiA z36*v?VHhS%^#oNL)yb9an4K_@Q>7|-3R$1DvC6wnbJBNdqguWvEe-nYjBjYz$dMdE zD5m0hBd11@l28yzs7g#xq9}@b6x4&_vZ4$si9s|FiTC&Q^(C%&Y3|f8O-Ui7L{*$I zw1PUX)9rS;pc`ry&uQu$UQjbycGgH8Q;CnnWATA_e5=3xJ=e0v@UY0hZ*UjBhDG=Y zK7r5SOtm}$ZE$Us^!9hs6LC#0HYiw4>#ZCfHVCZoRcrJ3?Q9H~KQ92!>WAKL;M+vp z^hwFN&%n>{9ef5Wa1o~Abr^$Q=YF;P(Ye&-5g1Qc0KkTIa%c$>|0U2YFs%oS=nbZ0 zLa-oG>~7%0sRR?rfT4!or9Oz&T2WtO843G^-{}|=0pzofn=s~z#Q+ELj)UINKR)BZB{GDW8*jF zvB}X<3g&WIBXulU)NtW{a7H<2R+0eOtzYwMrTlU|?`o{gJSW$<9q^}jy@dV(P`vC< delta 478 zcmZp8z|nAkV}i6`Gy?;J5)dl_F(VLrPSi1Gjb_lZ;Mkb5fS*~I+iWtsfcnNp4(`on z(q~x2Rxq&hmof0ajb8jr{3|A>=$onW@G#4BB$k$B#FrMQ z76FZ9;pJzRXDrE2$&UvSyyC3P#*EWHIxz}QzO1jqD7?vlC1Ej3g285%140W#m=7}d zF>Pj!WZcVC#;C^c#&6ERuw5&GQI?sB>-lugWJXsuLt{2^SNZAj$&9ko&GH%fmARWW zjo8KIe3e@$lGCz_U7R9q6DmzbNXq)?Vvl$?=Rq+vY$ zL<(c`^vx-Z3fps18LL@YfbNdp*ci>C)M#!6HoM6dY&P5-Ecp#Ww|aIi9nYI6pM2LzNP SW~V9?mlqT$B { } const renderCalendar = (dates, todos, clickDone) => ( - +
{CALENDAR_HEADER} {renderCalenderBody(dates, todos, clickDone)}
diff --git a/src/components/Calendar/Calendar.test.js b/src/components/Calendar/Calendar.test.js new file mode 100644 index 0000000..a8a1cd7 --- /dev/null +++ b/src/components/Calendar/Calendar.test.js @@ -0,0 +1,59 @@ +import React from 'react'; +import { shallow, mount } from 'enzyme'; +import Calendar from './Calendar'; + + +const mockTodos = [ + { + id: 1, title: 'TEST_TITLE_1', done: true, + year: 2019, + month: 9, + date: 1, + }, + { + id: 2, title: 'TEST_TITLE_2', done: false, + year: 2019, + month: 9, + date: 2, + }, + { + id: 3, title: 'TEST_TITLE_3', done: true, + year: 2019, + month: 10, + date: 1, + } +]; + +describe('', () => { + it('should render without errors', () => { + const component = shallow(); + const wrapper = component.find('.CalendarTable'); + expect(wrapper.length).toBe(1); + }); + + it('should render table without errors', () => { + const component = shallow(); + let wrapper = component.find("Table"); + expect(wrapper.length).toBe(1); + }); + + it('should render done for true', () => { + const component = shallow(); + let wrapper = component.find('.done'); + expect(wrapper.length).toBe(1); + }); + + it('should render notdone for false', () => { + const component = shallow(); + const wrapper = component.find('.notdone'); + expect(wrapper.length).toBe(1); + }); + + it('should handle clicks without errors', () => { + const mockClickDone = jest.fn(); + const component = shallow(); + const wrapper = component.find('.done').first(); + wrapper.simulate('click'); + expect(mockClickDone).toHaveBeenCalledTimes(1); + }); +}); \ No newline at end of file diff --git a/src/containers/TodoList/NewTodo/NewTodo.js b/src/containers/TodoList/NewTodo/NewTodo.js index 1ce93bc..7d2fd2a 100644 --- a/src/containers/TodoList/NewTodo/NewTodo.js +++ b/src/containers/TodoList/NewTodo/NewTodo.js @@ -23,7 +23,7 @@ class NewTodo extends Component { ...this.state, dueDate: { year: now.getFullYear(), - month: now.getMonth() + 1, + month: now.getMonth(), date: now.getDate(), }, }) @@ -42,6 +42,7 @@ class NewTodo extends Component { type="text" value={this.state.title} onChange={(event) => this.setState({ title: event.target.value })} + className="title" >