Fakultas Ilmu Komputer UI

Commit 27bc4f14 authored by Fajrin Kingwijati's avatar Fajrin Kingwijati
Browse files

Merge branch '1606837631-100' into 'master'

1606837631 100

See merge request !127
parents f0bdd7fa c0ec64e9
Pipeline #24784 passed with stages
in 31 minutes and 38 seconds
......@@ -55,6 +55,8 @@ export default class CreateVacancy extends React.Component {
close_time: moment(r.close_time),
loading: false,
tag: r.tag,
working_period: r.working_period,
max_accepted_applicants: r.max_accepted_applicants,
});
});
}
......@@ -131,7 +133,7 @@ export default class CreateVacancy extends React.Component {
</Header>
<Form loading={this.state.formLoading} onSubmit={this.handleSubmit}>
<Form.Field label="Posisi" name="name" control={Input} onChange={this.handleChange} value={this.state.name} required />
<label htmlFor="description"> <b> Deskipsi Lowongan </b> </label>
<label htmlFor="description"> <b> Deskripsi Lowongan </b> </label>
{ !this.state.loading &&
<CKEditor value={this.state.description} onChange={this.handleDescription} /> }
<script>CKEDITOR.replace( 'description' );</script>
......@@ -141,7 +143,7 @@ export default class CreateVacancy extends React.Component {
<CKEditor value={this.state.responsibilities} onChange={this.handleResponsibilities} /> }
<script>CKEDITOR.replace( 'responsibilities' );</script>
<br />
<Form.Field label="Jumlah yang Diterima" name="max_accepted_applicants" control={Input} onChange={this.handleChange} value={this.state.max_accepted_applicants} required />
<Form.Field label="Jumlah yang Diterima" name="max_accepted_applicants" type="number" min="1" control={Input} onChange={this.handleChange} value={this.state.max_accepted_applicants} required />
<label htmlFor="benefits"> <b> Keuntungan </b> </label>
{ !this.state.loading && <CKEditor value={this.state.benefits} onChange={this.handleBenefits} /> }
<script>CKEDITOR.replace( 'benefits' );</script>
......
import React from 'react';
import { Segment, Image, Header, Icon, Checkbox, Container, Button, Form, Grid, Message } from 'semantic-ui-react';
import { Segment, Image, Header, Icon, Checkbox, Button, Form } from 'semantic-ui-react';
import Server from './lib/Server';
import Storage from './lib/Storage';
import ModalAlert from './components/ModalAlert';
......
......@@ -25,6 +25,9 @@ describe('CreateVacancy', () => {
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet semper neque a fermentum. Duis ac tellus vitae augue iaculis ultrices. Curabitur commodo et neque nec feugiat. Morbi ac diam vel nunc commodo cursus. Phasellus nulla sapien, hendrerit vitae bibendum at, sollicitudin eu ante. Maecenas maximus, ante eu sollicitudin convallis, mauris nunc posuere risus, eu porttitor diam lacus vitae enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse at lectus a elit sollicitudin tempor. Nullam condimentum, justo nec tincidunt maximus, neque mi vulputate leo, sit amet lacinia massa ex eget sem. Duis ac erat facilisis, fringilla mauris in, consequat neque. In et neque consequat, vehicula magna at, efficitur ante. Mauris ac lacinia nibh.\r\n\r\nProin sagittis, lectus quis maximus varius, libero justo sollicitudin augue, non lacinia risus orci a enim. Curabitur iaculis enim quis ullamcorper commodo. Vivamus id nisi rhoncus, dignissim tellus quis, interdum est. Fusce sollicitudin eu libero ac feugiat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper posuere ex, sed accumsan libero iaculis faucibus. Fusce laoreet ac ligula ut consectetur. Donec tortor mauris, rutrum at sodales et, viverra in dolor. Sed bibendum elit et maximus volutpat. Phasellus justo ipsum, laoreet sit amet faucibus eu, ultricies suscipit mauris. Nullam aliquam libero eu ante ultrices mattis. Donec non justo hendrerit neque volutpat placerat. Ut euismod est nec sem mollis, sit amet porttitor massa rhoncus. Aenean id erat sit amet nunc ultrices scelerisque non in ipsum. Curabitur sollicitudin nulla id mi accumsan venenatis.',
verified: true,
benefits: 'Makan siang gratis, Waktu kerja fleksibel, Asuransi kesehatan, Liburan berbayar',
working_period: '5 hari',
max_accepted_applicants: 10,
salary: 5000000,
logo: 'http://localhost:8001/files/company-logo/8a258a48-3bce-4873-b5d1-538b360d0059.png',
address: 'Jl. Kebayoran Baru nomor 13, Jakarta Barat',
},
......
......@@ -3,7 +3,7 @@ import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import fetchMock from 'fetch-mock';
import VacancyPage from '../VacancyPage';
import { studentUser, companyUser, errorUser } from '../object/Response';
import { studentUser, companyUser } from '../object/Response';
describe('VacancyPage', () => {
fetchMock.get('*', { data: 'value' });
......
......@@ -6,8 +6,7 @@ import Storage from '../../lib/Storage';
import { response, response2 } from '../../object/Response';
describe('AdminVacancy', () => {
const fetchMock = require('fetch-mock');
it('renders for verified without problem', () => {
const lowongan = ReactTestUtils.renderIntoDocument(
<AdminVacancy status={4} data={response} />);
......
......@@ -48,7 +48,8 @@ describe('Vacancy', () => {
updated: '2017-03-28T07:34:13.122093Z',
working_period: 'Oktober-Desember',
verified: true,
max_accepted_applicants: 3,
max_accepted_applicants: 10,
salary: 5000000,
total_accepted_applicants: 0,
};
......
......@@ -679,6 +679,42 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
response_status_code = response.status_code
self.assertEqual(response_status_code, 200)
def test_max_accepted_applicants_contains_only_number(self):
self.payload[""] = "11"
response = self.client.post(
self.url,
self.payload,
format="json"
)
response_status_code = response.status_code
self.assertEqual(response_status_code, 200)
def test_max_accepted_applicants_contains_only_alphabet(self):
self.payload[""] = "abcd"
response = self.client.post(
self.url,
self.payload,
format="json"
)
response_status_code = response.status_code
self.assertEqual(response_status_code, 400)
def test_max_accepted_applicants_contains_number_and_alphabet(self):
self.payload[""] = "a1r1"
response = self.client.post(
self.url,
self.payload,
format="json"
)
response_status_code = response.status_code
self.assertEqual(response_status_code, 400)
def test_amount_contains_number_and_alphabet(self):
self.payload["salary"] = "sadas231"
......
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