mascot-vis 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/js/depGraphVis.js +0 -66
- package/src-new-ts/action/createElement.ts +0 -91
- package/src-new-ts/action/encode.js +0 -20
- package/src-new-ts/action/repeat.js +0 -128
- package/src-new-ts/action/traverseScene.js +0 -41
- package/src-new-ts/data/Network.js +0 -2
- package/src-new-ts/data/Scope.js +0 -135
- package/src-new-ts/data/Table.js +0 -263
- package/src-new-ts/data/Tree.js +0 -3
- package/src-new-ts/data/field.ts +0 -115
- package/src-new-ts/data/import.ts +0 -96
- package/src-new-ts/data/predicate.ts +0 -82
- package/src-new-ts/depgraph/DepGraph.js +0 -178
- package/src-new-ts/depgraph/Edge.js +0 -9
- package/src-new-ts/depgraph/SceneGraph2DepGraph.js +0 -110
- package/src-new-ts/depgraph/Signal.js +0 -12
- package/src-new-ts/depgraph/operator/BoundsEvaluator.js +0 -30
- package/src-new-ts/depgraph/operator/Dataflow.js +0 -41
- package/src-new-ts/depgraph/operator/DomainBuilder.js +0 -50
- package/src-new-ts/depgraph/updateDepGraph.js +0 -45
- package/src-new-ts/depgraph/variable/BoundsVar.js +0 -81
- package/src-new-ts/depgraph/variable/ChannelVar.js +0 -17
- package/src-new-ts/depgraph/variable/DataScopeVar.js +0 -12
- package/src-new-ts/depgraph/variable/DomainVar.js +0 -15
- package/src-new-ts/depgraph/variable/FieldVar.js +0 -17
- package/src-new-ts/depgraph/variable/LayoutParameter.js +0 -8
- package/src-new-ts/depgraph/variable/ScaleVar.js +0 -13
- package/src-new-ts/depgraph/variable/Variable.js +0 -39
- package/src-new-ts/element/gradient/LinearGradient.js +0 -37
- package/src-new-ts/element/group/Collection.js +0 -109
- package/src-new-ts/element/group/Group.js +0 -307
- package/src-new-ts/element/group/Scene.js +0 -98
- package/src-new-ts/element/mark/CircleMark.ts +0 -85
- package/src-new-ts/element/mark/Mark.ts +0 -233
- package/src-new-ts/element/mark/PathMark.js +0 -483
- package/src-new-ts/element/mark/Segment.js +0 -29
- package/src-new-ts/element/mark/Vertex.js +0 -118
- package/src-new-ts/encode/Scale.ts +0 -115
- package/src-new-ts/index.ts +0 -19
- package/src-new-ts/layout/Layout.ts +0 -3
- package/src-new-ts/render/CanvasRenderer.ts +0 -24
- package/src-new-ts/render/SVGRenderer.js +0 -316
- package/src-new-ts/util.ts +0 -3
- package/src-old/action/Classify.js +0 -53
- package/src-old/action/Densify.js +0 -199
- package/src-old/action/Partition.js +0 -531
- package/src-old/action/Repeat.js +0 -106
- package/src-old/action/Repopulate.js +0 -44
- package/src-old/action/Stratify.js +0 -156
- package/src-old/basic/Gradient.js +0 -37
- package/src-old/basic/Point.js +0 -51
- package/src-old/basic/Rectangle.js +0 -63
- package/src-old/bind/bindToAngle.js +0 -56
- package/src-old/bind/bindToAreaMark.js +0 -360
- package/src-old/bind/bindToColor.js +0 -114
- package/src-old/bind/bindToLink.js +0 -81
- package/src-old/bind/bindToPosition.js +0 -283
- package/src-old/bind/bindToRadialDistance.js +0 -62
- package/src-old/bind/bindToSize.js +0 -235
- package/src-old/bind/bindToText.js +0 -60
- package/src-old/bind/bindToThickness.js +0 -100
- package/src-old/constraint/AffixConstraint.js +0 -129
- package/src-old/constraint/AlignConstraint.js +0 -58
- package/src-old/core/Encoding.js +0 -336
- package/src-old/core/Scale.js +0 -322
- package/src-old/core/SceneLoader.js +0 -290
- package/src-old/core/SceneValidator.js +0 -232
- package/src-old/core/SpecExecutor.js +0 -113
- package/src-old/core/SpecGenerator.js +0 -350
- package/src-old/data/DataImporter.js +0 -64
- package/src-old/data/DataScope.js +0 -124
- package/src-old/data/DataTable.js +0 -338
- package/src-old/data/Network.js +0 -106
- package/src-old/data/Tree.js +0 -251
- package/src-old/data/transform/Bin.js +0 -46
- package/src-old/data/transform/Filter.js +0 -48
- package/src-old/data/transform/Groupby.js +0 -18
- package/src-old/data/transform/KDE.js +0 -58
- package/src-old/data/transform/Sort.js +0 -14
- package/src-old/data/transform/Split.js +0 -5
- package/src-old/data/transform/partition.js +0 -46
- package/src-old/history/UndoRedoStack +0 -0
- package/src-old/index.js +0 -271
- package/src-old/indexSVG.js +0 -259
- package/src-old/interaction/Interaction.js +0 -91
- package/src-old/interaction/MouseEvent.js +0 -8
- package/src-old/interaction/Selection.js +0 -9
- package/src-old/interaction/brush.js +0 -362
- package/src-old/item/Segment.js +0 -29
- package/src-old/item/Vertex.js +0 -118
- package/src-old/item/composite/Collection.js +0 -106
- package/src-old/item/composite/Glyph.js +0 -19
- package/src-old/item/composite/Group.js +0 -310
- package/src-old/item/composite/Scene.js +0 -1251
- package/src-old/item/mark/ArcPath.js +0 -181
- package/src-old/item/mark/AreaPath.js +0 -78
- package/src-old/item/mark/CirclePath.js +0 -102
- package/src-old/item/mark/EllipsePath.js +0 -5
- package/src-old/item/mark/Image.js +0 -101
- package/src-old/item/mark/LinkPath.js +0 -118
- package/src-old/item/mark/Mark.js +0 -163
- package/src-old/item/mark/Path.js +0 -494
- package/src-old/item/mark/PointText.js +0 -201
- package/src-old/item/mark/PolygonPath.js +0 -64
- package/src-old/item/mark/RectPath.js +0 -88
- package/src-old/item/mark/RingPath.js +0 -92
- package/src-old/item/refs/Axis.js +0 -362
- package/src-old/item/refs/EncodingAxis.js +0 -515
- package/src-old/item/refs/Gridlines.js +0 -144
- package/src-old/item/refs/LayoutAxis.js +0 -316
- package/src-old/item/refs/Legend.js +0 -273
- package/src-old/layout/Circular.js +0 -95
- package/src-old/layout/Force.js +0 -52
- package/src-old/layout/Grid.js +0 -423
- package/src-old/layout/Layout.js +0 -13
- package/src-old/layout/Packing.js +0 -56
- package/src-old/layout/Stack.js +0 -264
- package/src-old/layout/Strata.js +0 -88
- package/src-old/layout/Sugiyama.js +0 -59
- package/src-old/layout/TidyTree.js +0 -105
- package/src-old/layout/Treemap.js +0 -87
- package/src-old/renderer/SVGInteractionHandler.js +0 -241
- package/src-old/renderer/SVGRenderer.js +0 -325
- package/src-old/renderer/WebGLRenderer.js +0 -1097
- package/src-old/renderer/WebGLRenderer2.js +0 -249
- package/src-old/renderer/threejs/Line2.js +0 -18
- package/src-old/renderer/threejs/LineGeometry.js +0 -77
- package/src-old/renderer/threejs/LineMaterial.js +0 -605
- package/src-old/renderer/threejs/LineSegments2.js +0 -281
- package/src-old/renderer/threejs/LineSegmentsGeometry.js +0 -226
- package/src-old/renderer/threejs/Wireframe.js +0 -51
- package/src-old/renderer/threejs/WireframeGeometry2.js +0 -16
- package/src-old/scale/areaSize.js +0 -0
- package/src-old/scale/domain.js +0 -38
- package/src-old/util/Constants.js +0 -180
- package/src-old/util/DataUtil.js +0 -35
- package/src-old/util/ItemUtil.js +0 -586
- package/src-old/util/Numerical.js +0 -33
- package/tests/demo-tests/README.md +0 -80
- package/tests/demo-tests/SVG2PNG.js +0 -56
- package/tests/demo-tests/demos2CanvasPNGs.js +0 -69
- package/tests/demo-tests/demos2ScenesSVGs.js +0 -100
- package/tests/demo-tests/pathElementWorker.js +0 -91
- package/tests/demo-tests/pixelTest.js +0 -62
- package/tests/demo-tests/renderDemos.html +0 -132
- package/tests/demo-tests/serializationTest.js +0 -36
- package/tests/demo-tests/serializeDemos.html +0 -134
- package/tests/unit-tests/README.md +0 -4
- package/tests/unit-tests/jasmine-browser.json +0 -21
- package/tests/unit-tests/jasmine.json +0 -14
- package/tests/unit-tests/testSpec.js +0 -274
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"srcDir": "src",
|
|
3
|
-
"srcFiles": [],
|
|
4
|
-
"specDir": ".",
|
|
5
|
-
"specFiles": [
|
|
6
|
-
"tests/unit-tests/**/*[sS]pec.?(m)js"
|
|
7
|
-
],
|
|
8
|
-
"helpers": [
|
|
9
|
-
"tests/unit-tests/helpers/**/*.?(m)js"
|
|
10
|
-
],
|
|
11
|
-
"esmFilenameExtension": ".mjs",
|
|
12
|
-
"enableTopLevelAwait": false,
|
|
13
|
-
"env": {
|
|
14
|
-
"stopSpecOnExpectationFailure": false,
|
|
15
|
-
"stopOnSpecFailure": false,
|
|
16
|
-
"random": true
|
|
17
|
-
},
|
|
18
|
-
"browser": {
|
|
19
|
-
"name": "firefox"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import * as msc from "../../dist/mascot-es.js"
|
|
2
|
-
import { divideElement } from "../../src/action/divide.js";
|
|
3
|
-
import { translate } from "../../src/action/translate.js";
|
|
4
|
-
import GridPlacer from "../../src/depgraph/operator/layout/GridPlacer.js";
|
|
5
|
-
import { elementRemoved, layoutSpecified, newCollectionCreated, newMarkCreated, parentChildConnected } from "../../src/depgraph/updateDepGraph.js";
|
|
6
|
-
import { VarType } from "../../src/depgraph/variable/Variable.js";
|
|
7
|
-
import Collection from "../../src/element/group/Collection.js";
|
|
8
|
-
import { GridCorner, GridFillDirection } from "../../src/layout/LayoutConstants.js";
|
|
9
|
-
|
|
10
|
-
import LinearGradient from "../../src/element/gradient/LinearGradient.js"
|
|
11
|
-
|
|
12
|
-
describe("Mascot tests", function() {
|
|
13
|
-
let scn, dt;
|
|
14
|
-
|
|
15
|
-
beforeEach(async function() {
|
|
16
|
-
scn = msc.scene();
|
|
17
|
-
dt = await msc.csv("http://localhost:8020/datasets/csv/GDP Change.csv");// run 'npm run start' first
|
|
18
|
-
expect(dt).toBeDefined();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("repeat mark", async function() {
|
|
22
|
-
let circle = scn.mark("circle", { radius: 6, x: 100, y: 80, fillColor: "orange", strokeWidth: 0, strokeDash:"none", strokeColor: "#222"});
|
|
23
|
-
let coll = scn.repeat(circle, dt, {"attribute": "Year"});
|
|
24
|
-
expect(coll.children.length).toBe(4);
|
|
25
|
-
|
|
26
|
-
let gl = msc.layout("grid");
|
|
27
|
-
coll.layout = gl;
|
|
28
|
-
expect(gl.cellBounds.length).toBe(4);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it("rect mark", async function() {
|
|
32
|
-
let rect = scn.mark("rect", { top: 20, left: 100, width: 20, height: 20, fillColor: "orange", strokeWidth: 0});
|
|
33
|
-
let b = rect.bounds;
|
|
34
|
-
expect(b.left).toBe(100);
|
|
35
|
-
expect(b.top).toBe(20);
|
|
36
|
-
expect(b.x).toBe(110);
|
|
37
|
-
expect(b.y).toBe(30);
|
|
38
|
-
//scn.repeat(circle, dt, {"attribute": "company"});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("grid layout: start & direction", async function() {
|
|
42
|
-
let group = new Collection(), placer = new GridPlacer("gridPlacer");
|
|
43
|
-
for (let i = 0; i < 4; i++)
|
|
44
|
-
group.addChild(scn.mark("rect", { top: 20, left: 100, width: 20, height: 20, fillColor: "orange", strokeWidth: 0}));
|
|
45
|
-
|
|
46
|
-
let gl = msc.layout("grid", {numCols: 2, start: GridCorner.TopLeft, direction: GridFillDirection.RowFirst});
|
|
47
|
-
gl.group = group;
|
|
48
|
-
placer.fillGrid(group, gl);
|
|
49
|
-
expect(gl._grid[0][0]).toBe(0);
|
|
50
|
-
expect(gl._grid[0][1]).toBe(1);
|
|
51
|
-
expect(gl._grid[1][0]).toBe(2);
|
|
52
|
-
expect(gl._grid[1][1]).toBe(3);
|
|
53
|
-
|
|
54
|
-
gl = msc.layout("grid", {numCols: 2, start: GridCorner.TopLeft, direction: GridFillDirection.ColumnFirst});
|
|
55
|
-
gl.group = group;
|
|
56
|
-
placer.fillGrid(group, gl);
|
|
57
|
-
expect(gl._grid[0][0]).toBe(0);
|
|
58
|
-
expect(gl._grid[0][1]).toBe(2);
|
|
59
|
-
expect(gl._grid[1][0]).toBe(1);
|
|
60
|
-
expect(gl._grid[1][1]).toBe(3);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
gl = msc.layout("grid", {numCols: 2, start: GridCorner.BottomRight, direction: GridFillDirection.RowFirst});
|
|
64
|
-
gl.group = group;
|
|
65
|
-
placer.fillGrid(group, gl);
|
|
66
|
-
expect(gl._grid[0][0]).toBe(3);
|
|
67
|
-
expect(gl._grid[0][1]).toBe(2);
|
|
68
|
-
expect(gl._grid[1][0]).toBe(1);
|
|
69
|
-
expect(gl._grid[1][1]).toBe(0);
|
|
70
|
-
|
|
71
|
-
gl = msc.layout("grid", {numCols: 2, start: GridCorner.BottomRight, direction: GridFillDirection.ColumnFirst});
|
|
72
|
-
gl.group = group;
|
|
73
|
-
placer.fillGrid(group, gl);
|
|
74
|
-
expect(gl._grid[0][0]).toBe(3);
|
|
75
|
-
expect(gl._grid[0][1]).toBe(1);
|
|
76
|
-
expect(gl._grid[1][0]).toBe(2);
|
|
77
|
-
expect(gl._grid[1][1]).toBe(0);
|
|
78
|
-
|
|
79
|
-
gl = msc.layout("grid", {numCols: 2, start: GridCorner.TopRight, direction: GridFillDirection.RowFirst});
|
|
80
|
-
gl.group = group;
|
|
81
|
-
placer.fillGrid(group, gl);
|
|
82
|
-
expect(gl._grid[0][0]).toBe(1);
|
|
83
|
-
expect(gl._grid[0][1]).toBe(0);
|
|
84
|
-
expect(gl._grid[1][0]).toBe(3);
|
|
85
|
-
expect(gl._grid[1][1]).toBe(2);
|
|
86
|
-
|
|
87
|
-
gl = msc.layout("grid", {numCols: 2, start: GridCorner.TopRight, direction: GridFillDirection.ColumnFirst});
|
|
88
|
-
gl.group = group;
|
|
89
|
-
placer.fillGrid(group, gl);
|
|
90
|
-
expect(gl._grid[0][0]).toBe(2);
|
|
91
|
-
expect(gl._grid[0][1]).toBe(0);
|
|
92
|
-
expect(gl._grid[1][0]).toBe(3);
|
|
93
|
-
expect(gl._grid[1][1]).toBe(1);
|
|
94
|
-
|
|
95
|
-
gl = msc.layout("grid", {numCols: 2, start: GridCorner.BottomLeft, direction: GridFillDirection.RowFirst});
|
|
96
|
-
gl.group = group;
|
|
97
|
-
placer.fillGrid(group, gl);
|
|
98
|
-
expect(gl._grid[0][0]).toBe(2);
|
|
99
|
-
expect(gl._grid[0][1]).toBe(3);
|
|
100
|
-
expect(gl._grid[1][0]).toBe(0);
|
|
101
|
-
expect(gl._grid[1][1]).toBe(1);
|
|
102
|
-
|
|
103
|
-
gl = msc.layout("grid", {numCols: 2, start: GridCorner.BottomLeft, direction: GridFillDirection.ColumnFirst});
|
|
104
|
-
gl.group = group;
|
|
105
|
-
placer.fillGrid(group, gl);
|
|
106
|
-
expect(gl._grid[0][0]).toBe(1);
|
|
107
|
-
expect(gl._grid[0][1]).toBe(3);
|
|
108
|
-
expect(gl._grid[1][0]).toBe(0);
|
|
109
|
-
expect(gl._grid[1][1]).toBe(2);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it ("glyph bounds", async function() {
|
|
113
|
-
let rect = scn.mark("rect", { top: 20, left: 100, width: 20, height: 20, fillColor: "orange", strokeWidth: 0}),
|
|
114
|
-
line = scn.mark("line", {x1: 0, y1: 10, x2: 20, y2: 20});
|
|
115
|
-
let glyph = scn.glyph(rect, line);
|
|
116
|
-
let c1 = scn.repeat(glyph, dt, {"attribute": "Quarter"});
|
|
117
|
-
expect(c1.bounds.width).toBe(120);
|
|
118
|
-
expect(c1.bounds.height).toBe(30);
|
|
119
|
-
expect(c1.bounds.left).toBe(0);
|
|
120
|
-
expect(c1.bounds.top).toBe(10);
|
|
121
|
-
|
|
122
|
-
expect(glyph.refBounds.width).toBe(120);
|
|
123
|
-
expect(glyph.refBounds.height).toBe(30);
|
|
124
|
-
expect(glyph.refBounds.left).toBe(0);
|
|
125
|
-
expect(glyph.refBounds.top).toBe(10);
|
|
126
|
-
|
|
127
|
-
expect(rect.refBounds.width).toBe(20);
|
|
128
|
-
expect(rect.refBounds.height).toBe(20);
|
|
129
|
-
expect(rect.refBounds.left).toBe(100);
|
|
130
|
-
expect(rect.refBounds.top).toBe(20);
|
|
131
|
-
|
|
132
|
-
expect(line.refBounds.width).toBe(20);
|
|
133
|
-
expect(line.refBounds.height).toBe(10);
|
|
134
|
-
expect(line.refBounds.left).toBe(0);
|
|
135
|
-
expect(line.refBounds.top).toBe(10);
|
|
136
|
-
|
|
137
|
-
c1.layout = msc.layout("grid", {numCols: 2, rowGap: 10, colGap: 10});
|
|
138
|
-
let line2 = c1.children[1].children[1];
|
|
139
|
-
|
|
140
|
-
expect(line2.refBounds.width).toBe(20);
|
|
141
|
-
expect(line2.refBounds.height).toBe(10);
|
|
142
|
-
expect(line2.refBounds.left).toBe(130);
|
|
143
|
-
expect(line2.refBounds.top).toBe(10);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it("nested collection bounds", async function() {
|
|
147
|
-
let rect = scn.mark("rect", { top: 0, left: 0, width: 100, height: 20, fillColor: "orange", strokeWidth: 0});
|
|
148
|
-
let c1 = scn.repeat(rect, dt, {"attribute": "Quarter"});
|
|
149
|
-
c1.layout = msc.layout("grid", {numCols: 1, rowGap: 10});
|
|
150
|
-
let c = scn.repeat(c1, dt, {attribute: "Year"});
|
|
151
|
-
c.layout = msc.layout("grid", {numCols: 1, rowGap: 10});
|
|
152
|
-
let c2 = c.children[1];
|
|
153
|
-
expect(c1.bounds.width).toBe(100);
|
|
154
|
-
expect(c1.bounds.height).toBe(110);
|
|
155
|
-
expect(c1.bounds.left).toBe(0);
|
|
156
|
-
expect(c1.bounds.top).toBe(0);
|
|
157
|
-
|
|
158
|
-
expect(c2.bounds.width).toBe(100);
|
|
159
|
-
expect(c2.bounds.height).toBe(110);
|
|
160
|
-
expect(c2.bounds.left).toBe(0);
|
|
161
|
-
expect(c2.bounds.top).toBe(120);
|
|
162
|
-
|
|
163
|
-
expect(c.bounds.width).toBe(100);
|
|
164
|
-
expect(c.bounds.height).toBe(470);
|
|
165
|
-
expect(c.bounds.left).toBe(0);
|
|
166
|
-
expect(c.bounds.top).toBe(0);
|
|
167
|
-
|
|
168
|
-
expect(c2.layout.cellBounds[0].top).toBe(120);
|
|
169
|
-
expect(c2.layout.cellBounds[1].top).toBe(150);
|
|
170
|
-
|
|
171
|
-
let r2 = c1.children[1];
|
|
172
|
-
expect(r2.bounds.width).toBe(100);
|
|
173
|
-
expect(r2.bounds.height).toBe(20);
|
|
174
|
-
expect(r2.bounds.left).toBe(0);
|
|
175
|
-
expect(r2.bounds.top).toBe(30);
|
|
176
|
-
expect(r2.refBounds.width).toBe(100);
|
|
177
|
-
expect(r2.refBounds.height).toBe(20);
|
|
178
|
-
expect(r2.refBounds.left).toBe(0);
|
|
179
|
-
expect(r2.refBounds.top).toBe(30);
|
|
180
|
-
|
|
181
|
-
let r6 = c2.children[1];
|
|
182
|
-
expect(r6.bounds.width).toBe(100);
|
|
183
|
-
expect(r6.bounds.height).toBe(20);
|
|
184
|
-
expect(r6.bounds.left).toBe(0);
|
|
185
|
-
expect(r6.bounds.top).toBe(150);
|
|
186
|
-
expect(r6.refBounds.width).toBe(100);
|
|
187
|
-
expect(r6.refBounds.height).toBe(20);
|
|
188
|
-
expect(r6.refBounds.left).toBe(0);
|
|
189
|
-
expect(r6.refBounds.top).toBe(150);
|
|
190
|
-
|
|
191
|
-
translate(c, 100, 100);
|
|
192
|
-
expect(r6.refBounds.width).toBe(100);
|
|
193
|
-
expect(r6.refBounds.height).toBe(20);
|
|
194
|
-
expect(r6.refBounds.left).toBe(100);
|
|
195
|
-
expect(r6.refBounds.top).toBe(250);
|
|
196
|
-
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
it("divide", async function() {
|
|
200
|
-
let rect = scn.mark("rect", { top: 0, left: 0, width: 100, height: 20, fillColor: "orange", strokeWidth: 0});
|
|
201
|
-
let c1 = scn.repeat(rect, dt, {"attribute": "Year"});
|
|
202
|
-
c1.layout = msc.layout("grid", {numCols: 1, rowGap: 10});
|
|
203
|
-
//let c = scn.divide(rect, dt, {attribute: "Quarter"});
|
|
204
|
-
//c.layout = msc.layout("grid", {numCols: 1, rowGap: 10});
|
|
205
|
-
|
|
206
|
-
let c = divideElement(scn, rect, "Quarter", undefined, dt);
|
|
207
|
-
elementRemoved(rect, scn._depGraph);
|
|
208
|
-
newMarkCreated(c.children[0], scn._depGraph);
|
|
209
|
-
newCollectionCreated(c, scn._depGraph);
|
|
210
|
-
layoutSpecified(c, c.layout, scn._depGraph);
|
|
211
|
-
parentChildConnected(c, c.children[0], scn._depGraph);
|
|
212
|
-
parentChildConnected(c.parent, c, scn._depGraph);
|
|
213
|
-
let rbv = scn._depGraph.findVariable(VarType.CHANNEL, ["x", c]);
|
|
214
|
-
// expect(rbv).toBeDefined();
|
|
215
|
-
// expect(rbv.incomingDataflow.type).toBe(OpType.GRID_LAYOUT);
|
|
216
|
-
//gv = scn._depGraph.getIncomingDataflowOperator(OpType.GRID_LAYOUT, c1);
|
|
217
|
-
// expect(c.layout.type).toBe("stack");
|
|
218
|
-
// let bv = scn._depGraph.getVariable(VarType.BOUNDS, rect),
|
|
219
|
-
// gv = scn._depGraph.getIncomingDataflowOperator(OpType.GRID_LAYOUT, c1);
|
|
220
|
-
// expect(gv).not.toEqual(null);
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
describe("LinearGradient Class", function() {
|
|
229
|
-
let linearGradient;
|
|
230
|
-
|
|
231
|
-
beforeEach(function() {
|
|
232
|
-
linearGradient = new LinearGradient();
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it("should correctly initialize with default parameters", function() {
|
|
236
|
-
expect(linearGradient.x1).toBe(0);
|
|
237
|
-
expect(linearGradient.x2).toBe(100);
|
|
238
|
-
expect(linearGradient.y1).toBe(0);
|
|
239
|
-
expect(linearGradient.y2).toBe(0);
|
|
240
|
-
expect(linearGradient.stops).toEqual([]);
|
|
241
|
-
expect(linearGradient.type).toBeDefined();
|
|
242
|
-
expect(linearGradient.id.startsWith(linearGradient.type)).toBeTrue();
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
it("should correctly initialize with provided parameters", function() {
|
|
246
|
-
const params = { x1: 10, x2: 90, y1: 20, y2: 30 };
|
|
247
|
-
const customGradient = new LinearGradient(params);
|
|
248
|
-
expect(customGradient.x1).toBe(params.x1);
|
|
249
|
-
expect(customGradient.x2).toBe(params.x2);
|
|
250
|
-
expect(customGradient.y1).toBe(params.y1);
|
|
251
|
-
expect(customGradient.y2).toBe(params.y2);
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
it("should add stops correctly", function() {
|
|
255
|
-
linearGradient.addStop(50, 'red', 1);
|
|
256
|
-
expect(linearGradient.stops.length).toBe(1);
|
|
257
|
-
expect(linearGradient.stops[0]).toEqual({ offset: 50, color: 'red', opacity: 1 });
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
it("should correctly convert to JSON", function() {
|
|
261
|
-
linearGradient.addStop(50, 'red', 1);
|
|
262
|
-
const json = linearGradient.toJSON();
|
|
263
|
-
expect(json.x1).toBe(0);
|
|
264
|
-
expect(json.x2).toBe(100);
|
|
265
|
-
expect(json.y1).toBe(0);
|
|
266
|
-
expect(json.y2).toBe(0);
|
|
267
|
-
expect(json.stops.length).toBe(1);
|
|
268
|
-
expect(json.stops[0]).toEqual({ offset: 50, color: 'red', opacity: 1 });
|
|
269
|
-
expect(json.type).toBeDefined();
|
|
270
|
-
expect(json.id.startsWith(json.type)).toBeTrue();
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
// Add more tests as needed
|
|
274
|
-
});
|