Gantt chart - add minutes and seconds durations

This commit is contained in:
Derek Brans
2015-08-25 14:49:56 -07:00
parent 3ec7c6d18b
commit 1d371e0a1e
2 changed files with 47 additions and 21 deletions

View File

@@ -27,7 +27,7 @@ describe('when using the ganttDb',function() {
expect(tasks[0].id ).toEqual('id1');
expect(tasks[0].description).toEqual('test1');
});
it('should handle duration instead of fixed date to determine end date', function () {
it('should handle duration (days) instead of fixed date to determine end date', function () {
gDb.setDateFormat('YYYY-MM-DD');
gDb.addSection('testa1');
gDb.addTask('test1','id1,2013-01-01,2d');
@@ -37,7 +37,7 @@ describe('when using the ganttDb',function() {
expect(tasks[0].id ).toEqual('id1');
expect(tasks[0].description).toEqual('test1');
});
it('should handle duration instead of fixed date to determine end date', function () {
it('should handle duration (hours) instead of fixed date to determine end date', function () {
gDb.setDateFormat('YYYY-MM-DD');
gDb.addSection('testa1');
gDb.addTask('test1','id1,2013-01-01,2h');
@@ -47,7 +47,27 @@ describe('when using the ganttDb',function() {
expect(tasks[0].id ).toEqual('id1');
expect(tasks[0].description).toEqual('test1');
});
it('should handle ', function () {
it('should handle duration (minutes) instead of fixed date to determine end date', function () {
gDb.setDateFormat('YYYY-MM-DD');
gDb.addSection('testa1');
gDb.addTask('test1','id1,2013-01-01,2m');
var tasks = gDb.getTasks();
expect(tasks[0].startTime).toEqual(moment('2013-01-01', 'YYYY-MM-DD').toDate());
expect(tasks[0].endTime ).toEqual(moment('2013-01-01 00:02', 'YYYY-MM-DD hh:mm').toDate());
expect(tasks[0].id ).toEqual('id1');
expect(tasks[0].description).toEqual('test1');
});
it('should handle duration (seconds) instead of fixed date to determine end date', function () {
gDb.setDateFormat('YYYY-MM-DD');
gDb.addSection('testa1');
gDb.addTask('test1','id1,2013-01-01,2s');
var tasks = gDb.getTasks();
expect(tasks[0].startTime).toEqual(moment('2013-01-01', 'YYYY-MM-DD').toDate());
expect(tasks[0].endTime ).toEqual(moment('2013-01-01 00:00:02', 'YYYY-MM-DD hh:mm:ss').toDate());
expect(tasks[0].id ).toEqual('id1');
expect(tasks[0].description).toEqual('test1');
});
it('should handle duration (weeks) instead of fixed date to determine end date', function () {
gDb.setDateFormat('YYYY-MM-DD');
gDb.addSection('testa1');
gDb.addTask('test1','id1,2013-01-01,2w');