Fakultas Ilmu Komputer UI

Commit 4bbb61a6 authored by Zamil Majdy's avatar Zamil Majdy
Browse files

Fix alert modal not shown after applying vacancy

parent 77ed36db
...@@ -6,8 +6,8 @@ import TranscriptPage from '../TranscriptPage'; ...@@ -6,8 +6,8 @@ import TranscriptPage from '../TranscriptPage';
describe('TranscriptPage', () => { describe('TranscriptPage', () => {
const data = { const data = {
transcript: [ transcript: [
{ kelas: { nm_kls: 'kelas1' }, nilai: 'A' }, { kelas: { nm_kls: 'kelas1', nm_mk_cl: { nm_mk: 'mata_kuliah' } }, nilai: 'A' },
{ kelas: { nm_kls: 'kelas2' }, nilai: 'B' }, { kelas: { nm_kls: 'kelas2', nm_mk_cl: { nm_mk: 'mata_kuliah' } }, nilai: 'B' },
{ nilai: 'B' }, { nilai: 'B' },
], ],
name: 'Badak Terbang', name: 'Badak Terbang',
...@@ -16,9 +16,11 @@ describe('TranscriptPage', () => { ...@@ -16,9 +16,11 @@ describe('TranscriptPage', () => {
fetchMock.get('*', data); fetchMock.get('*', data);
it('renders for admin without problem', () => { it('renders for admin without problem', () => {
const transcriptPage = ReactTestUtils.renderIntoDocument( const transcriptPage1 = ReactTestUtils.renderIntoDocument(<TranscriptPage params={{ id: 1 }} user={{ role: 'student' }} />);
<TranscriptPage params={{ id: 1 }} />); const transcriptPage2 = ReactTestUtils.renderIntoDocument(<TranscriptPage params={{ id: 1 }} user={{ role: 'admin' }} />);
transcriptPage.setState({data}) transcriptPage1.setState({ data });
expect(transcriptPage).to.exist; transcriptPage2.setState({ data });
expect(transcriptPage1).to.exist;
expect(transcriptPage2).to.exist;
}); });
}); });
...@@ -56,8 +56,10 @@ export default class ApplyModal extends React.Component { ...@@ -56,8 +56,10 @@ export default class ApplyModal extends React.Component {
this.setState({ load: true }); this.setState({ load: true });
const requestData = { vacancy_id: this.props.data.id, cover_letter: this.state.coverLetter }; const requestData = { vacancy_id: this.props.data.id, cover_letter: this.state.coverLetter };
Server.post(`/students/${this.props.studentId}/applied-vacancies/`, requestData).then(() => { 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.modalAlert.open('Pendaftaran Berhasil', 'Pendaftaran anda berhasil direkam. Harap menunggu kabar selanjutnya dari pihak yang terkait\n', () => {
this.props.updateStatus('registered'); 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), }, () => this.modalAlert.open('Pendaftaran Gagal', 'Maaf pendaftaran yang anda lakukan gagal. Harap ulangi pendaftaran atau hubungi administrator\n', this.handleClose),
); );
}; };
......
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