adding tests to suite

This commit is contained in:
Ezequiel Bergamaschi 2014-10-26 18:43:16 -03:00
parent 8202248bad
commit 00ab6fd61a
3 changed files with 50 additions and 51 deletions

View File

@ -280,7 +280,7 @@
<source>lib/web2d.svg-min.js</source> <source>lib/web2d.svg-min.js</source>
<source>libraries/hotkeys/jquery.hotkeys.js</source> <source>libraries/hotkeys/jquery.hotkeys.js</source>
<source>libraries/underscorejs/underscore-min.js</source> <source>libraries/underscorejs/underscore-min.js</source>
<source>libraries/bootstrap/underscore-min.js</source> <source>libraries/bootstrap/js/bootstrap.js</source>
</preloadSources> </preloadSources>
<sourceIncludes> <sourceIncludes>
<include>header.js</include> <include>header.js</include>

View File

@ -1,69 +1,68 @@
var setup = function() { var designer = null;
/*:DOC += <div id="mindplot"></div> */ /*:DOC += <div id="mindplot"></div> */
var mapId = '1'; var mapId = '1';
var 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>'; var 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>';
var editorProperties = {"zoom":0.7, size: {width: "1366px", height:"768px"}}; var editorProperties = {"zoom":0.7, size: {width: "1366px", height:"768px"}};
var buildMindmapDesigner = function() { var buildMindmapDesigner = function() {
// Initialize message logger ... // Initialize message logger ...
var container = $('<div id="mindplot"></div>'); var container = $('<div id="mindplot"></div>');
$("body").append(container); $("body").append(container);
// Initialize Editor ... // Initialize Editor ...
var window = $(window); var window = $(window);
var screenWidth = window.width(); var screenWidth = window.width();
var screenHeight = window.height(); var screenHeight = window.height();
// Positionate node ... // Positionate node ...
// header - footer // header - footer
screenHeight = screenHeight - 90 - 61; screenHeight = screenHeight - 90 - 61;
// body margin ... // body margin ...
editorProperties.width = screenWidth; editorProperties.width = screenWidth;
editorProperties.height = screenHeight; editorProperties.height = screenHeight;
var designer = new mindplot.Designer(editorProperties, container); designer = new mindplot.Designer(editorProperties, container);
/*var persistence = mindplot.PersistenceManager.getInstance(); // Load map from XML file persisted on disk...
designer.loadMap(mapId, mapXml); var persistence = new mindplot.LocalStorageManager("src/test/resources/welcome.xml");
*/ var mindmap = persistence.load(mapId);
designer.loadMap(mindmap);
/*// Save map on load .... /*// Save map on load ....
if (editorProperties.saveOnLoad) if (editorProperties.saveOnLoad)
{ {
var saveOnLoad = function() { var saveOnLoad = function() {
designer.save(function() { designer.save(function() {
}, false); }, false);
}.delay(1000) }.delay(1000)
}*/ }*/
}
buildMindmapDesigner();
} }
buildMindmapDesigner();
describe("Designer test suite", function() { describe("Designer test suite", function() {
beforeEach(function() {
//setup();
});
it("testWorkspaceBuild", function(){ it("testWorkspaceBuild", function(){
var id = $(document).attr('id'); var mindplot = $(document).find('#mindplot');
expect(id).not.toBeNull(); expect(mindplot).not.toBeNull();
//expect(id).not.toBeUndefined(); expect(mindplot).not.toBeUndefined();
}); });
/*testCentralTopicPresent:function(){ it("testCentralTopicPresent", function(){
var centralTopic = designer.getCentralTopic(); var centralTopic = designer.getMindmap().getCentralTopic();
assertNotNull(centralTopic); expect($defined(centralTopic)).toBe(true);
var position = centralTopic.getPosition(); var position = centralTopic.getPosition();
assertEquals(0,position.x); expect(position.x).toEqual(0);
assertEquals(0,position.y); expect(position.y).toEqual(0);
}, });
testMouseCreateMainTopic:function(){ /*it("testCentralTopicPresent", function(){
var centralTopic = designer.getCentralTopic(); var centralTopic = designer.getMindmap().getCentralTopic();
assertNotNull(centralTopic); expect($defined(centralTopic)).toBe(true);
var target = designer.getWorkSpace().getScreenManager().getContainer(); var target = designer.getWorkSpace().getScreenManager().getContainer();
var size = designer.getModel().getTopics().length; var size = designer.getModel().getTopics().length;
fireNativeEvent('dblclick',target,new core.Point(50,50)); fireNativeEvent('dblclick',target,new core.Point(50,50));
assertEquals(size+1, designer.getModel().getTopics().length); assertEquals(size+1, designer.getModel().getTopics().length);
}*/ });
*/
}); });

View File

@ -1 +1 @@
../../../../web2d/target/classes/web2d.svg-min.js ../../../../../web2d/target/classes/web2d.svg-min.js