diff --git a/assets/js/ApplicantPage.jsx b/assets/js/ApplicantPage.jsx index 2931c861f6ace5619a6db83b6bbb741e542e17c3..adf39901098d8bfd0be81c0cd9b99cf8f8d8f3d5 100644 --- a/assets/js/ApplicantPage.jsx +++ b/assets/js/ApplicantPage.jsx @@ -29,21 +29,11 @@ export default class ApplicantPage extends React.Component { const company = this.props.user.data.company; return ( <Tabs selected={0}> - <Pane label="Lamaran Baru" > - <ApplicantList key={1} companyId={company.id} url={`/companies/${company.id}/applications/?status=${Applicant.APPLICATION_STATUS.NEW}`} status={Applicant.APPLICATION_STATUS.NEW} /> - </Pane> - <Pane label="Lamaran Dibaca" > - <ApplicantList key={2} companyId={company.id} url={`/companies/${company.id}/applications/?status=${Applicant.APPLICATION_STATUS.READ}`} status={Applicant.APPLICATION_STATUS.READ} /> - </Pane> - <Pane label="Lamaran Ditandai" > - <ApplicantList key={3} companyId={company.id} url={`/companies/${company.id}/applications/?status=${Applicant.APPLICATION_STATUS.BOOKMARKED}`} status={Applicant.APPLICATION_STATUS.BOOKMARKED} /> - </Pane> - <Pane label="Lamaran Diterima" > - <ApplicantList key={4} companyId={company.id} url={`/companies/${company.id}/applications/?status=${Applicant.APPLICATION_STATUS.ACCEPTED}`} status={Applicant.APPLICATION_STATUS.ACCEPTED} /> - </Pane> - <Pane label="Lamaran Ditolak" > - <ApplicantList key={5} companyId={company.id} url={`/companies/${company.id}/applications/?status=${Applicant.APPLICATION_STATUS.REJECTED}`} status={Applicant.APPLICATION_STATUS.REJECTED} /> - </Pane> + <ApplicantList label="Lamaran Baru" key={1} companyId={company.id} url={`/companies/${company.id}/applications/?status=${Applicant.APPLICATION_STATUS.NEW}`} status={Applicant.APPLICATION_STATUS.NEW} /> + <ApplicantList label="Lamaran Dibaca" key={2} companyId={company.id} url={`/companies/${company.id}/applications/?status=${Applicant.APPLICATION_STATUS.READ}`} status={Applicant.APPLICATION_STATUS.READ} /> + <ApplicantList label="Lamaran Ditandai" key={3} companyId={company.id} url={`/companies/${company.id}/applications/?status=${Applicant.APPLICATION_STATUS.BOOKMARKED}`} status={Applicant.APPLICATION_STATUS.BOOKMARKED} /> + <ApplicantList label="Lamaran Diterima" key={4} companyId={company.id} url={`/companies/${company.id}/applications/?status=${Applicant.APPLICATION_STATUS.ACCEPTED}`} status={Applicant.APPLICATION_STATUS.ACCEPTED} /> + <ApplicantList label="Lamaran Ditolak" key={5} companyId={company.id} url={`/companies/${company.id}/applications/?status=${Applicant.APPLICATION_STATUS.REJECTED}`} status={Applicant.APPLICATION_STATUS.REJECTED} /> </Tabs> ); } diff --git a/assets/js/Dashboard.jsx b/assets/js/Dashboard.jsx index c317fa5a8aa4b22997fddec9c9483602f1a79e08..83fe6ec240dcb72441dde58ed8c0e9cb9af46a15 100755 --- a/assets/js/Dashboard.jsx +++ b/assets/js/Dashboard.jsx @@ -1,6 +1,6 @@ import React from 'react'; import TopMenu from './components/TopMenu'; -import Footer from './components/Footer' +import Footer from './components/Footer'; export default class Dashboard extends React.Component { static propTypes = { diff --git a/assets/js/ProfilePage.jsx b/assets/js/ProfilePage.jsx index f3a512b6756d4064c1068601323a58c44bb7045c..fb1fe596bcbc8ef9ec429d7b502f25dac1b9f0d8 100644 --- a/assets/js/ProfilePage.jsx +++ b/assets/js/ProfilePage.jsx @@ -89,7 +89,7 @@ export default class ProfilePage extends React.Component { const form = this.state.form; form[e.target.name] = e.target.files[0]; this.setState({ form }); - } + }; handleChange = (e) => { const form = this.state.form; diff --git a/assets/js/__test__/components/ApplyModal-test.jsx b/assets/js/__test__/components/ApplyModal-test.jsx index f06675e173670ac571d3b40a5f81e99f731c6584..1119ff7caf68e2043b4803570fb7d64bdd3f3a76 100644 --- a/assets/js/__test__/components/ApplyModal-test.jsx +++ b/assets/js/__test__/components/ApplyModal-test.jsx @@ -2,6 +2,7 @@ import React from 'react'; import ReactTestUtils from 'react-addons-test-utils'; import ApplyModal from '../../components/ApplyModal'; +import fetchMock from 'fetch-mock'; describe('ApplyModal', () => { it('renders without problem', () => { @@ -11,12 +12,25 @@ describe('ApplyModal', () => { }); it('open without problem', () => { + fetchMock.post('*', {}); const modalPendaftaran = ReactTestUtils.renderIntoDocument( <ApplyModal id={4} data={{ key: 'value' }} buttonTitle="submit" apply={() => {}}/>); const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalPendaftaran, 'Button'); modalPendaftaran.handleApply(); ReactTestUtils.Simulate.click(modal); expect(modalPendaftaran).to.exist; + fetchMock.restore(); + }); + + it('open with problem', () => { + fetchMock.post('*', 404); + const modalPendaftaran = ReactTestUtils.renderIntoDocument( + <ApplyModal id={4} data={{ key: 'value' }} buttonTitle="submit" apply={() => {}}/>); + const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalPendaftaran, 'Button'); + modalPendaftaran.handleApply(); + ReactTestUtils.Simulate.click(modal); + expect(modalPendaftaran).to.exist; + fetchMock.restore(); }); it('change without problem', () => { diff --git a/assets/js/__test__/components/ApproveModal-test.jsx b/assets/js/__test__/components/ApproveModal-test.jsx index 739192afbadc615a999a6a84ee95b2e848fea0f6..255581c58787b26bfd071b162d1c7e1146f0acb8 100644 --- a/assets/js/__test__/components/ApproveModal-test.jsx +++ b/assets/js/__test__/components/ApproveModal-test.jsx @@ -3,6 +3,7 @@ import React from 'react'; import ReactTestUtils from 'react-addons-test-utils'; import fetchMock from 'fetch-mock'; import ApproveModal from '../../components/ApproveModal'; +import Applicant from '../../components/Applicant'; describe('ApproveModal', () => { it('renders without problem', () => { @@ -14,7 +15,7 @@ describe('ApproveModal', () => { it('open without problem', () => { fetchMock.get('*', { student: { resume: 'asdasd' } }); const modalApproval = ReactTestUtils.renderIntoDocument( - <ApproveModal updateStatus={() => {}} data={{ key: 'value', student: { resume: 'asdasd' } }} />); + <ApproveModal updateStatus={() => {}} data={{ key: 'value', student: { resume: 'asdasd' }, status: Applicant.APPLICATION_STATUS.NEW }} />); const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalApproval, 'Button'); ReactTestUtils.Simulate.click(modal); @@ -24,8 +25,9 @@ describe('ApproveModal', () => { it('close without problem', () => { fetchMock.get('*', { student: { resume: 'asdasd' } }); + fetchMock.patch('*', { student: { resume: 'asdasd' } }); const modalApproval = ReactTestUtils.renderIntoDocument( - <ApproveModal updateStatus={() => {}} data={{ key: 'value', student: { resume: 'asdasd' } }} />); + <ApproveModal updateStatus={() => {}} data={{ key: 'value', student: { resume: 'asdasd' }, status: Applicant.APPLICATION_STATUS.NEW }} />); modalApproval.handleClose(); expect(modalApproval.state.modalOpen).to.equal(false); diff --git a/assets/js/__test__/components/Vacancy-test.jsx b/assets/js/__test__/components/Vacancy-test.jsx index 7d99368d8b6d03d53cd547a1fe5c31d58512ed27..65222b3d2e5625f6036b85f26b7f4372304ea6fb 100644 --- a/assets/js/__test__/components/Vacancy-test.jsx +++ b/assets/js/__test__/components/Vacancy-test.jsx @@ -99,30 +99,4 @@ describe('Vacancy', () => { expect(lowongan.bookmark()).to.be.undefined; fetchMock.restore(); }); - - it('apply without problem', () => { - fetchMock.post('*', response); - fetchMock.delete('*', response); - const lowongan = ReactTestUtils.renderIntoDocument( - <Vacancy status="Daftar" data={response2} bookmarked={1}/>); - const response3 = { student: { id: 1, name: 2 } }; - lowongan.apply(1); - expect(lowongan.props.data.id).to.equal(3); - Storage.set('user-data', response3); - expect(lowongan.bookmark()).to.be.undefined; - fetchMock.restore(); - }); - - it('apply with problem', () => { - fetchMock.post('*', 404); - fetchMock.delete('*', response); - const lowongan = ReactTestUtils.renderIntoDocument( - <Vacancy status="Daftar" data={response2} bookmarked={1}/>); - const response3 = { student: { id: 1, name: 2 } }; - lowongan.apply(1); - expect(lowongan.props.data.id).to.equal(3); - Storage.set('user-data', response3); - expect(lowongan.bookmark()).to.be.undefined; - fetchMock.restore(); - }); });