Эх сурвалжийг харах

unittests: row sizes are merged

Ievgen Naida 5 жил өмнө
parent
commit
8bdb8328bd

+ 3 - 7
index.html

@@ -43,11 +43,8 @@
   <script type="text/javascript">
     let rows = [
       {
-        style: {
-          height: 1,
-          keyframesStyle: {
-            shape: "rect"
-          }
+        keyframesStyle: {
+          shape: "rect"
         },
         selected: false,
         draggable: false,
@@ -66,8 +63,7 @@
       },
       {
         //keyframesShape: "rect",
-        drawKeyframes: true,
-
+        //height: 40,
         selected: false,
         hidden: false,
         keyframes: [

+ 44 - 0
tests/js/styleTests.js

@@ -101,5 +101,49 @@ describe('TimelineStyleUtils', function () {
             asserts_1.assert.equal(animation_timeline_1.TimelineStyleUtils.stripeDraggable(rowStyle, globalStyle), false);
         });
     });
+    describe('Height', function () {
+        it('Height is taken from row', function () {
+            var globalStyle = {
+                rowsStyle: {
+                    height: 100,
+                    keyframesStyle: {},
+                },
+            };
+            var rowsStyle = { height: 50 };
+            asserts_1.assert.equal(animation_timeline_1.TimelineStyleUtils.getRowHeight(rowsStyle, globalStyle), rowsStyle.height);
+        });
+        it('Height is taken from global settings', function () {
+            var globalStyle = {
+                rowsStyle: {
+                    height: 100,
+                    keyframesStyle: {},
+                },
+            };
+            var rowsStyle = {};
+            asserts_1.assert.equal(animation_timeline_1.TimelineStyleUtils.getRowHeight(rowsStyle, globalStyle), globalStyle.rowsStyle.height);
+        });
+        it('Margin bottom is taken from global settings', function () {
+            var globalStyle = {
+                rowsStyle: {
+                    height: 100,
+                    marginBottom: 30,
+                    keyframesStyle: {},
+                },
+            };
+            var rowsStyle = {};
+            asserts_1.assert.equal(animation_timeline_1.TimelineStyleUtils.getRowMarginBottom(rowsStyle, globalStyle), globalStyle.rowsStyle.marginBottom);
+        });
+        it('Margin bottom is taken from row settings', function () {
+            var globalStyle = {
+                rowsStyle: {
+                    height: 100,
+                    marginBottom: 30,
+                    keyframesStyle: {},
+                },
+            };
+            var rowsStyle = { marginBottom: 43 };
+            asserts_1.assert.equal(animation_timeline_1.TimelineStyleUtils.getRowMarginBottom(rowsStyle, globalStyle), rowsStyle.marginBottom);
+        });
+    });
 });
 //# sourceMappingURL=styleTests.js.map

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
tests/js/styleTests.js.map


+ 48 - 0
tests/styleTests.ts

@@ -118,4 +118,52 @@ describe('TimelineStyleUtils', function () {
       assert.equal(TimelineStyleUtils.stripeDraggable(rowStyle, globalStyle), false);
     });
   });
+  describe('Row size', function () {
+    it('Height is taken from row', function () {
+      const globalStyle = {
+        rowsStyle: {
+          height: 100,
+          keyframesStyle: {},
+        } as TimelineRowStyle,
+      } as TimelineOptions;
+
+      const rowsStyle = { height: 50 } as TimelineRowStyle;
+      assert.equal(TimelineStyleUtils.getRowHeight(rowsStyle, globalStyle), rowsStyle.height);
+    });
+    it('Height is taken from global settings', function () {
+      const globalStyle = {
+        rowsStyle: {
+          height: 100,
+          keyframesStyle: {},
+        } as TimelineRowStyle,
+      } as TimelineOptions;
+
+      const rowsStyle = {} as TimelineRowStyle;
+      assert.equal(TimelineStyleUtils.getRowHeight(rowsStyle, globalStyle), globalStyle.rowsStyle.height);
+    });
+    it('Margin bottom is taken from global settings', function () {
+      const globalStyle = {
+        rowsStyle: {
+          height: 100,
+          marginBottom: 30,
+          keyframesStyle: {},
+        } as TimelineRowStyle,
+      } as TimelineOptions;
+
+      const rowsStyle = {} as TimelineRowStyle;
+      assert.equal(TimelineStyleUtils.getRowMarginBottom(rowsStyle, globalStyle), globalStyle.rowsStyle.marginBottom);
+    });
+    it('Margin bottom is taken from row settings', function () {
+      const globalStyle = {
+        rowsStyle: {
+          height: 100,
+          marginBottom: 30,
+          keyframesStyle: {},
+        } as TimelineRowStyle,
+      } as TimelineOptions;
+
+      const rowsStyle = { marginBottom: 43 } as TimelineRowStyle;
+      assert.equal(TimelineStyleUtils.getRowMarginBottom(rowsStyle, globalStyle), rowsStyle.marginBottom);
+    });
+  });
 });

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно