Fakultas Ilmu Komputer UI

Commit 1efdc708 authored by Rahmania Astrid Mochtar's avatar Rahmania Astrid Mochtar
Browse files

Merge branch '1606828702-132' into 'master'

1606828702 132

See merge request !167
parents 84c33fbd cf208c4f
Pipeline #25186 passed with stages
in 13 minutes and 23 seconds
......@@ -14,7 +14,7 @@ describe('ApplyModal', () => {
it('open without problem', () => {
fetchMock.post('*', {});
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<ApplyModal id={4} data={{ key: 'value' }} buttonTitle="submit" apply={() => {}}/>);
<ApplyModal id={4} data={{ key: 'value' }} buttonTitle="submit" apply={() => {}} resume="ada" />);
const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalPendaftaran, 'Button');
modalPendaftaran.handleApply();
ReactTestUtils.Simulate.click(modal);
......@@ -25,7 +25,7 @@ describe('ApplyModal', () => {
it('open with problem', () => {
fetchMock.post('*', 404);
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<ApplyModal id={4} data={{ key: 'value' }} buttonTitle="submit" apply={() => {}}/>);
<ApplyModal id={4} data={{ key: 'value' }} buttonTitle="submit" apply={() => {}} resume="ada" />);
const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalPendaftaran, 'Button');
modalPendaftaran.handleApply();
ReactTestUtils.Simulate.click(modal);
......@@ -56,4 +56,14 @@ describe('ApplyModal', () => {
modalPendaftaran.handleChange({ target: { value: 'duar' } });
expect(modalPendaftaran.props.data.companydescription).to.equal('compdesc');
});
// it('apply without resume', () => {
// const modalPendaftaran = ReactTestUtils.renderIntoDocument(
// <ApplyModal id={4} data={{ key: 'value', companydescription: 'compdesc' }} buttonTitle="submit" />);
// const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalPendaftaran, 'Button');
// modalPendaftaran.handleApply();
// ReactTestUtils.Simulate.click(modal);
// expect(modalPendaftaran).to.exist;
// fetchMock.restore();
// });
});
......@@ -65,37 +65,22 @@ export default class ApplyModal extends React.Component {
});
handleApply = () => {
this.setState({ load: true });
const requestData = {
vacancy_id: this.props.data.id,
cover_letter: this.state.coverLetter,
};
Server.post(
`/students/${this.props.studentId}/applied-vacancies/`,
requestData,
).then(
() => {
this.modalAlert.open(
'Pendaftaran Berhasil',
'Pendaftaran anda berhasil direkam. Harap menunggu kabar selanjutnya dari pihak yang terkait\n',
() => {
this.handleClose();
this.props.updateStatus('registered');
},
);
},
() =>
this.modalAlert.open(
'Pendaftaran Gagal',
'Maaf pendaftaran yang anda lakukan gagal. Harap ulangi pendaftaran atau hubungi administrator\n',
this.handleClose,
),
);
if (this.props.resume) {
this.setState({ load: true });
const requestData = { vacancy_id: this.props.data.id, cover_letter: this.state.coverLetter };
Server.post(`/students/${this.props.studentId}/applied-vacancies/`, requestData).then(() => {
this.modalAlert.open('Pendaftaran Berhasil', 'Pendaftaran anda berhasil direkam. Harap menunggu kabar selanjutnya dari pihak yang terkait\n', () => {
this.handleClose();
this.props.updateStatus('registered');
});
}, () => this.modalAlert.open('Pendaftaran Gagal', 'Maaf pendaftaran yang anda lakukan gagal. Harap ulangi pendaftaran atau hubungi administrator\n', this.handleClose));
} else {
this.modalAlert.open('Pendaftaran Gagal', 'Harap menambahkan CV anda terlebih dahulu sebelum mendaftar\n', this.handleClose);
}
};
render() {
const isApplicationClosed =
moment(this.props.data.close_time) < moment.now();
const isApplicationClosed = moment(this.props.data.close_time) < moment.now();
return (
<Modal
trigger={
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment