mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-11 01:43:23 +01:00
cb2ca74a20
Core-js, web2d and mindplot working baseline * fix .eslintignore remove Raphael dependency * Fix to avoid crashes in _plotPrediction whitout Raphael * Fix minplot basic code inspections * Fix last inspections errors * Inital refactor copying files * Clean up. * Fix web2d cyclic dependencies remove only-warn eslint plugin set import/no-extraneous-dependencies to warn (incorrectly complaining about root package) * Fix web2d Point references (no need to assign it to core) Fix web2d imports in mindplot and update Point refs * Merge 'feature/mindplot_tests' into web2d-coreJS-solutions * mindplot fixes and add viewmode.html playground setup playground config to run the map-render examples fix mindplot components export mootools Static was not working so refactored it fix some references to _peer fix messages __bundle undefined add web2d missing export: Image downgrade cypress to avoid SIGSEGV error Approved-by: Paulo Veiga
64 lines
2.4 KiB
JavaScript
64 lines
2.4 KiB
JavaScript
let designer = null;
|
|
/*: DOC += <div id="mindplot"></div> */
|
|
const mapId = '1';
|
|
const mapXml = '<map name="1" version="pela"><topic central="true" text="test" id="1"><topic position="103,-52" order="" id="2"/><topic position="-134,-75" order="" id="3"/><topic position="-126,5" order="" id="4"/><topic position="-115,53" order="" id="5"/><topic position="-136,-35" order="" id="6"/></topic></map>';
|
|
const editorProperties = { zoom: 0.7, size: { width: '1366px', height: '768px' } };
|
|
const buildMindmapDesigner = function () {
|
|
// Initialize message logger ...
|
|
const container = $('<div id="mindplot"></div>');
|
|
$('body').append(container);
|
|
|
|
// Initialize Editor ...
|
|
var window = $(window);
|
|
const screenWidth = window.width();
|
|
let screenHeight = window.height();
|
|
|
|
// Positionate node ...
|
|
// header - footer
|
|
screenHeight = screenHeight - 90 - 61;
|
|
|
|
// body margin ...
|
|
editorProperties.width = screenWidth;
|
|
editorProperties.height = screenHeight;
|
|
|
|
designer = new mindplot.Designer(editorProperties, container);
|
|
// Load map from XML file persisted on disk...
|
|
const persistence = new mindplot.LocalStorageManager('src/test/resources/welcome.xml');
|
|
const mindmap = persistence.load(mapId);
|
|
designer.loadMap(mindmap);
|
|
|
|
/* // Save map on load ....
|
|
if (editorProperties.saveOnLoad)
|
|
{
|
|
var saveOnLoad = function() {
|
|
designer.save(function() {
|
|
}, false);
|
|
}.delay(1000)
|
|
} */
|
|
};
|
|
buildMindmapDesigner();
|
|
|
|
describe('Designer test suite', () => {
|
|
it('testWorkspaceBuild', () => {
|
|
const mindplot = $(document).find('#mindplot');
|
|
expect(mindplot).not.toBeNull();
|
|
expect(mindplot).not.toBeUndefined();
|
|
});
|
|
it('testCentralTopicPresent', () => {
|
|
const centralTopic = designer.getMindmap().getCentralTopic();
|
|
expect($defined(centralTopic)).toBe(true);
|
|
const position = centralTopic.getPosition();
|
|
expect(position.x).toEqual(0);
|
|
expect(position.y).toEqual(0);
|
|
});
|
|
/* it("testCentralTopicPresent", function(){
|
|
var centralTopic = designer.getMindmap().getCentralTopic();
|
|
expect($defined(centralTopic)).toBe(true);
|
|
var target = designer.getWorkSpace().getScreenManager().getContainer();
|
|
var size = designer.getModel().getTopics().length;
|
|
fireNativeEvent('dblclick',target,new web2d.Point(50,50));
|
|
assertEquals(size+1, designer.getModel().getTopics().length);
|
|
});
|
|
*/
|
|
});
|