Files
Michael Cartner b9c60b07dc 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>
2024-01-26 11:52:55 +01:00

52 lines
1.3 KiB
JavaScript

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'
}
]
}
}
]
};
});