pull/295/head
Piero Toffanin 2017-09-06 11:47:04 -04:00
rodzic 96395c39aa
commit 040bf0b96b
21 zmienionych plików z 182 dodań i 3 usunięć

Wyświetl plik

@ -7,8 +7,13 @@ import Paginated from './Paginated';
import Paginator from './Paginator';
import ErrorMessage from './ErrorMessage';
import { Route } from 'react-router-dom';
import PropTypes from 'prop-types';
class ProjectList extends Paginated {
static propTypes = {
history: PropTypes.object.isRequired,
}
constructor(props){
super(props);

Wyświetl plik

@ -9,9 +9,16 @@ import EditProjectDialog from './EditProjectDialog';
import Dropzone from '../vendor/dropzone';
import csrf from '../django/csrf';
import HistoryNav from '../classes/HistoryNav';
import PropTypes from 'prop-types';
import $ from 'jquery';
class ProjectListItem extends React.Component {
static propTypes = {
history: PropTypes.object.isRequired,
data: PropTypes.object.isRequired, // project json
onDelete: PropTypes.func
}
constructor(props){
super(props);

Wyświetl plik

@ -1,8 +1,15 @@
import React from 'react';
import '../css/TaskList.scss';
import TaskListItem from './TaskListItem';
import PropTypes from 'prop-types';
class TaskList extends React.Component {
static propTypes = {
history: PropTypes.object.isRequired,
source: PropTypes.string.isRequired, // URL where to load task list
onDelete: PropTypes.func
}
constructor(props){
super(props);

Wyświetl plik

@ -7,8 +7,16 @@ import ErrorMessage from './ErrorMessage';
import EditTaskPanel from './EditTaskPanel';
import AssetDownloadButtons from './AssetDownloadButtons';
import HistoryNav from '../classes/HistoryNav';
import PropTypes from 'prop-types';
class TaskListItem extends React.Component {
static propTypes = {
history: PropTypes.object.isRequired,
data: PropTypes.object.isRequired, // task json
refreshInterval: PropTypes.number, // how often to refresh info
onDelete: PropTypes.func
}
constructor(props){
super();

Wyświetl plik

@ -1,6 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
class UploadProgressBar extends React.Component {
static propTypes = {
progress: PropTypes.number,
totalBytesSent: PropTypes.number,
totalBytes: PropTypes.number,
totalCount: PropTypes.number // number of files
}
// http://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript
bytesToSize(bytes, decimals = 2){

Wyświetl plik

@ -2,7 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import EditPresetDialog from '../EditPresetDialog';
let presetMock = require('../../tests/utils/MockLoader').load("preset.json");
const presetMock = require('../../tests/utils/MockLoader').load("preset.json");
describe('<EditPresetDialog />', () => {
it('renders without exploding', () => {

Wyświetl plik

@ -2,7 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import EditTaskPanel from '../EditTaskPanel';
let taskMock = require('../../tests/utils/MockLoader').load("task.json");
const taskMock = require('../../tests/utils/MockLoader').load("task.json");
describe('<EditTaskPanel />', () => {
it('renders without exploding', () => {

Wyświetl plik

@ -4,7 +4,10 @@ import FormDialog from '../FormDialog';
describe('<FormDialog />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<FormDialog bind={[new MockComponent(), 'error']} />);
const wrapper = shallow(<FormDialog
getFormData={() => {}}
reset={() => {}}
saveAction={() => {}} />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,14 @@
import React from 'react';
import { shallow } from 'enzyme';
import Map from '../Map';
describe('<Map />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<Map
tiles={['/tiles.json']} />);
// TODO: componentDidUpdate method is never called
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import NewTaskPanel from '../NewTaskPanel';
describe('<NewTaskPanel />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<NewTaskPanel onSave={() => {}} />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,16 @@
import React from 'react';
import { shallow } from 'enzyme';
import Paginated from '../Paginated';
class MockComponent extends Paginated {
render(){
return <div/>;
}
}
describe('<Paginated />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<MockComponent history={{}} />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import Paginator from '../Paginator';
describe('<Paginator />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<Paginator />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import ProcessingNodeOption from '../ProcessingNodeOption';
describe('<ProcessingNodeOption />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<ProcessingNodeOption name="test" defaultValue={true} />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import ProjectList from '../ProjectList';
describe('<ProjectList />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<ProjectList history={{}} />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,16 @@
import React from 'react';
import { shallow } from 'enzyme';
import ProjectListItem from '../ProjectListItem';
const projectMock = require('../../tests/utils/MockLoader').load("project.json");
describe('<ProjectListItem />', () => {
it('renders without exploding', () => {
// TODO: load history mock
const wrapper = shallow(<ProjectListItem
history={window.history}
data={projectMock} />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import Standby from '../Standby';
describe('<Standby />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<Standby />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import SwitchModeButton from '../SwitchModeButton';
describe('<SwitchModeButton />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<SwitchModeButton />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import TaskList from '../TaskList';
describe('<TaskList />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<TaskList history={{}} source="tasklist.json" />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,13 @@
import React from 'react';
import { shallow } from 'enzyme';
import TaskListItem from '../TaskListItem';
const taskMock = require('../../tests/utils/MockLoader').load("task.json");
describe('<TaskListItem />', () => {
it('renders without exploding', () => {
// TODO: load history mock
const wrapper = shallow(<TaskListItem history={{}} data={taskMock} />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import UploadProgressBar from '../UploadProgressBar';
describe('<UploadProgressBar />', () => {
it('renders without exploding', () => {
const wrapper = shallow(<UploadProgressBar />);
expect(wrapper.exists()).toBe(true);
})
});

Wyświetl plik

@ -0,0 +1,3 @@
// TODO: how?
export default {};