| ÎļþÃû´Ó src/components/v-gantt-chart/test/gtUtils.test.js ÐÞ¸Ä |
| | |
| | | var expect = require('chai').expect; |
| | | var expect = require('chai').expect |
| | | var func = require('../lib/utils/gtUtils') |
| | | import dayjs from 'dayjs' |
| | | |
| | | describe('æµè¯gtUtils.js', function() { |
| | | |
| | | describe('æµè¯getWidthAbout2Times彿°', function() { |
| | | it('ç¸åæ¶é´ 计ç®ç»æä¸º0', function() { |
| | | expect(func.getWidthAbout2Times(dayjs( |
| | | '2018-10-10 10:00:00'), dayjs( |
| | | '2018-10-10 10:00:00'), dayjs( |
| | | '2018-10-10 10:00:00'), { |
| | | scale: 60, |
| | | cellWidth: 60 |
| | | })) |
| | | .to.be.equal(0); |
| | | }); |
| | | scale: 60, |
| | | cellWidth: 60 |
| | | })) |
| | | .to.be.equal(0) |
| | | }) |
| | | |
| | | it('æ°æ®æµè¯1', function() { |
| | | expect(func.getWidthAbout2Times(dayjs( |
| | | '2018-10-10 10:00:00'), dayjs( |
| | | '2018-10-10 11:00:00'), { |
| | | '2018-10-10 11:00:00'), { |
| | | scale: 60, |
| | | cellWidth: 60 |
| | | })).to.equal(60) |
| | | }); |
| | | }) |
| | | |
| | | it('æ°æ®æµè¯2', function() { |
| | | expect(func.getWidthAbout2Times(dayjs( |
| | | '2018-10-10 00:00:00'), dayjs( |
| | | '2018-10-10 01:10:00'), { |
| | | '2018-10-10 01:10:00'), { |
| | | scale: 1, |
| | | cellWidth: 1 |
| | | })).to.equal(70) |
| | | }); |
| | | }) |
| | | |
| | | it('æ°æ®æµè¯3', function() { |
| | | expect(func.getWidthAbout2Times(dayjs( |
| | | '2018-10-11 10:00:00'), dayjs( |
| | | '2018-10-11 00:00:00'), { |
| | | '2018-10-11 00:00:00'), { |
| | | scale: 10, |
| | | cellWidth: 10 |
| | | })).to.equal(-600) |
| | | }); |
| | | }) |
| | | |
| | | it('æ°æ®æµè¯4', function() { |
| | | expect(func.getWidthAbout2Times(dayjs( |
| | | '2018-10-10 00:00:00'), dayjs( |
| | | '2018-10-10 10:00:00'), { |
| | | '2018-10-10 10:00:00'), { |
| | | scale: 10, |
| | | cellWidth: 60 |
| | | })).to.equal(3600) |
| | | }); |
| | | }); |
| | | }) |
| | | }) |
| | | |
| | | describe('æµè¯getPositonOffset彿°', function() { |
| | | it('ç¸åæ¶é´ 计ç®ç»æä¸º0', function() { |
| | | expect(func.getPositonOffset(dayjs( |
| | | '2018-10-10 10:00:00'), dayjs( |
| | | '2018-10-10 10:00:00'), dayjs( |
| | | '2018-10-10 10:00:00'), { |
| | | scale: 60, |
| | | cellWidth: 60 |
| | | })) |
| | | .to.be.equal(0); |
| | | }); |
| | | scale: 60, |
| | | cellWidth: 60 |
| | | })) |
| | | .to.be.equal(0) |
| | | }) |
| | | |
| | | it('æ°æ®æµè¯1', function() { |
| | | expect(func.getPositonOffset(dayjs( |
| | | '2018-10-10 10:00:00'), dayjs( |
| | | '2018-10-10 11:00:00'), { |
| | | '2018-10-10 11:00:00'), { |
| | | scale: 60, |
| | | cellWidth: 60 |
| | | })).to.equal(-60) |
| | | }); |
| | | }) |
| | | |
| | | it('æ°æ®æµè¯2', function() { |
| | | expect(func.getPositonOffset(dayjs( |
| | | '2018-10-10 00:00:00'), dayjs( |
| | | '2018-10-10 01:10:00'), { |
| | | '2018-10-10 01:10:00'), { |
| | | scale: 60, |
| | | cellWidth: 60 |
| | | })).to.equal(-70) |
| | | }); |
| | | }) |
| | | |
| | | it('æ°æ®æµè¯3', function() { |
| | | expect(func.getPositonOffset(dayjs( |
| | | '2018-10-11 10:00:00'), dayjs( |
| | | '2018-10-11 00:00:00'), { |
| | | '2018-10-11 00:00:00'), { |
| | | scale: 60, |
| | | cellWidth: 60 |
| | | })).to.equal(+600) |
| | | }); |
| | | }) |
| | | |
| | | it('æ°æ®æµè¯4', function() { |
| | | expect(func.getPositonOffset(dayjs( |
| | | '2018-10-10 00:00:00'), dayjs( |
| | | '2018-10-10 10:00:00'), { |
| | | '2018-10-10 10:00:00'), { |
| | | scale: 60, |
| | | cellWidth: 60 |
| | | })).to.equal(-600) |
| | | }); |
| | | }); |
| | | |
| | | }); |
| | | }) |
| | | }) |
| | | }) |