init
This commit is contained in:
commit
063ced7795
40 files changed
+25274
No files matched your search
@@ -0,0 +1,73 @@
|
||||
import {
|
||||
seedDates,
|
||||
addToDate,
|
||||
getWeekNumberISO8601,
|
||||
} from '../src/helpers/date-helper';
|
||||
import { ViewMode } from '../src/types/public-types';
|
||||
|
||||
describe('seed date', () => {
|
||||
test('daily', () => {
|
||||
expect(
|
||||
seedDates(new Date(2020, 5, 28), new Date(2020, 6, 2), ViewMode.Day)
|
||||
).toEqual([
|
||||
new Date(2020, 5, 28),
|
||||
new Date(2020, 5, 29),
|
||||
new Date(2020, 5, 30),
|
||||
new Date(2020, 6, 1),
|
||||
new Date(2020, 6, 2),
|
||||
]);
|
||||
});
|
||||
|
||||
test('weekly', () => {
|
||||
expect(
|
||||
seedDates(new Date(2020, 5, 28), new Date(2020, 6, 19), ViewMode.Week)
|
||||
).toEqual([
|
||||
new Date(2020, 5, 28),
|
||||
new Date(2020, 6, 5),
|
||||
new Date(2020, 6, 12),
|
||||
new Date(2020, 6, 19),
|
||||
]);
|
||||
});
|
||||
|
||||
test('monthly', () => {
|
||||
expect(
|
||||
seedDates(new Date(2020, 5, 28), new Date(2020, 6, 19), ViewMode.Month)
|
||||
).toEqual([new Date(2020, 5, 28), new Date(2020, 6, 28)]);
|
||||
});
|
||||
|
||||
test('quarterly', () => {
|
||||
expect(
|
||||
seedDates(
|
||||
new Date(2020, 5, 28),
|
||||
new Date(2020, 5, 29),
|
||||
ViewMode.QuarterDay
|
||||
)
|
||||
).toEqual([
|
||||
new Date(2020, 5, 28, 0, 0),
|
||||
new Date(2020, 5, 28, 6, 0),
|
||||
new Date(2020, 5, 28, 12, 0),
|
||||
new Date(2020, 5, 28, 18, 0),
|
||||
new Date(2020, 5, 29, 0, 0),
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('add to date', () => {
|
||||
test('add month', () => {
|
||||
expect(addToDate(new Date(2020, 0, 1), 40, 'month')).toEqual(
|
||||
new Date(2023, 4, 1)
|
||||
);
|
||||
});
|
||||
|
||||
test('add day', () => {
|
||||
expect(addToDate(new Date(2020, 0, 1), 40, 'day')).toEqual(
|
||||
new Date(2020, 1, 10)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test('get week number', () => {
|
||||
expect(getWeekNumberISO8601(new Date(2019, 11, 31))).toEqual('01');
|
||||
expect(getWeekNumberISO8601(new Date(2021, 0, 1))).toEqual('53');
|
||||
expect(getWeekNumberISO8601(new Date(2020, 6, 20))).toEqual('30');
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Gantt } from '../src/index';
|
||||
|
||||
describe('gantt', () => {
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(
|
||||
<Gantt
|
||||
tasks={[
|
||||
{
|
||||
start: new Date(2020, 0, 1),
|
||||
end: new Date(2020, 2, 2),
|
||||
name: 'Redesign website',
|
||||
id: 'Task 0',
|
||||
progress: 45,
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
div
|
||||
);
|
||||
ReactDOM.unmountComponentAtNode(div);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user