mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-01-12 07:12:54 +01:00
Initial commit
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com> Co-Authored-By: Johan <4934465+joolsus@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
51
packages/noodl-editor/tests/nodegraph/createnewnode.js
Normal file
51
packages/noodl-editor/tests/nodegraph/createnewnode.js
Normal file
@@ -0,0 +1,51 @@
|
||||
const CreateNewNodePanel = require('@noodl-views/createnewnodepanel');
|
||||
const { ProjectModel } = require('@noodl-models/projectmodel');
|
||||
const NodeLibrary = require('@noodl-models/nodelibrary').NodeLibrary;
|
||||
|
||||
describe('Create new node panel unit tests', function () {
|
||||
var p, cp;
|
||||
|
||||
xit('can setup panel', function () {
|
||||
ProjectModel.instance = new ProjectModel();
|
||||
|
||||
p = ProjectModel.fromJSON(project);
|
||||
|
||||
cp = new CreateNewNodePanel({
|
||||
model: p.getComponentWithName('Root').graph,
|
||||
pos: {
|
||||
x: 100,
|
||||
y: 50
|
||||
},
|
||||
runtimeType: 'browser'
|
||||
});
|
||||
cp.render();
|
||||
expect(cp).not.toBe(undefined);
|
||||
});
|
||||
|
||||
xit('can create nodes', function () {
|
||||
var c = p.getComponentWithName('Root');
|
||||
cp.performCreate(NodeLibrary.instance.getNodeTypeWithName('group'));
|
||||
|
||||
expect(c.graph.roots.length).toBe(2);
|
||||
expect(c.graph.roots[1].type).toBe(NodeLibrary.instance.getNodeTypeWithName('group'));
|
||||
expect(c.graph.roots[1].x).toBe(100);
|
||||
expect(c.graph.roots[1].y).toBe(50);
|
||||
expect(c.graph.roots[1].version).toBe(2);
|
||||
});
|
||||
|
||||
var project = {
|
||||
components: [
|
||||
{
|
||||
name: 'Root',
|
||||
graph: {
|
||||
roots: [
|
||||
{
|
||||
id: 'A',
|
||||
type: 'group'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user