loulijun2021
2022-11-04 b4a6ec8d451c391a5c5bb8b67b032f640babac42
src/lib/v-gantt-chart/test/gtUtils.test.js
@@ -1,8 +1,9 @@
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(
@@ -11,8 +12,8 @@
        scale: 60,
        cellWidth: 60
      }))
        .to.be.equal(0)
    })
        .to.be.equal(0);
    });
    it('数据测试1', function() {
      expect(func.getWidthAbout2Times(dayjs(
@@ -21,7 +22,7 @@
        scale: 60,
        cellWidth: 60
      })).to.equal(60)
    })
    });
    it('数据测试2', function() {
      expect(func.getWidthAbout2Times(dayjs(
@@ -30,7 +31,7 @@
        scale: 1,
        cellWidth: 1
      })).to.equal(70)
    })
    });
    it('数据测试3', function() {
      expect(func.getWidthAbout2Times(dayjs(
@@ -39,7 +40,7 @@
        scale: 10,
        cellWidth: 10
      })).to.equal(-600)
    })
    });
    it('数据测试4', function() {
      expect(func.getWidthAbout2Times(dayjs(
@@ -48,8 +49,8 @@
        scale: 10,
        cellWidth: 60
      })).to.equal(3600)
    })
  })
    });
  });
  describe('测试getPositonOffset函数', function() {
    it('相同时间 计算结果为0', function() {
@@ -59,8 +60,8 @@
        scale: 60,
        cellWidth: 60
      }))
        .to.be.equal(0)
    })
        .to.be.equal(0);
    });
    it('数据测试1', function() {
      expect(func.getPositonOffset(dayjs(
@@ -69,7 +70,7 @@
        scale: 60,
        cellWidth: 60
      })).to.equal(-60)
    })
    });
    it('数据测试2', function() {
      expect(func.getPositonOffset(dayjs(
@@ -78,7 +79,7 @@
        scale: 60,
        cellWidth: 60
      })).to.equal(-70)
    })
    });
    it('数据测试3', function() {
      expect(func.getPositonOffset(dayjs(
@@ -87,7 +88,7 @@
        scale: 60,
        cellWidth: 60
      })).to.equal(+600)
    })
    });
    it('数据测试4', function() {
      expect(func.getPositonOffset(dayjs(
@@ -96,6 +97,7 @@
        scale: 60,
        cellWidth: 60
      })).to.equal(-600)
    })
  })
})
    });
  });
});