浏览代码

unittest Coordinates. min is positive

Ievgen Naida 5 年之前
父节点
当前提交
2106a6dc24
共有 3 个文件被更改,包括 28 次插入0 次删除
  1. 13 0
      tests/js/timelineTests.js
  2. 0 0
      tests/js/timelineTests.js.map
  3. 15 0
      tests/timelineTests.ts

+ 13 - 0
tests/js/timelineTests.js

@@ -408,6 +408,19 @@ describe('Timeline', function () {
             chai.expect(timeline.pxToVal(75)).equal(50);
             chai.expect(timeline.pxToVal(100)).equal(100);
         });
+        it('Coordinates. min is positive', function () {
+            var timeline = new animation_timeline_1.Timeline();
+            timeline._setOptions({
+                stepVal: 100,
+                stepPx: 50,
+                min: 100,
+                zoom: 1,
+            });
+            chai.expect(timeline.valToPx(100)).equal(0);
+            chai.expect(timeline.valToPx(150)).equal(25);
+            chai.expect(timeline.pxToVal(0)).equal(100);
+            chai.expect(timeline.pxToVal(25)).equal(150);
+        });
         it('Zoom is respected', function () {
             var timeline = new animation_timeline_1.Timeline();
             timeline._setOptions({

文件差异内容过多而无法显示
+ 0 - 0
tests/js/timelineTests.js.map


+ 15 - 0
tests/timelineTests.ts

@@ -433,6 +433,21 @@ describe('Timeline', function () {
       chai.expect(timeline.pxToVal(75)).equal(50);
       chai.expect(timeline.pxToVal(100)).equal(100);
     });
+    it('Coordinates. min is positive', function () {
+      const timeline = new Timeline();
+      timeline._setOptions({
+        stepVal: 100,
+        stepPx: 50,
+        min: 100,
+        zoom: 1,
+      } as TimelineOptions);
+
+      chai.expect(timeline.valToPx(100)).equal(0);
+      chai.expect(timeline.valToPx(150)).equal(25);
+
+      chai.expect(timeline.pxToVal(0)).equal(100);
+      chai.expect(timeline.pxToVal(25)).equal(150);
+    });
     it('Zoom is respected', function () {
       const timeline = new Timeline();
       timeline._setOptions({

部分文件因为文件数量过多而无法显示