Don't serialize/deserialize invalid order values.

This commit is contained in:
Paulo Gustavo Veiga 2011-05-10 19:28:24 -03:00
parent 84fbe241d0
commit 6b1cafb8fb
4 changed files with 12 additions and 6 deletions

View File

@ -64,7 +64,10 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
} else } else
{ {
var order = topic.getOrder(); var order = topic.getOrder();
parentTopic.setAttribute("order", order); if(core.Utils.isDefined(order) && !isNaN(order-0))
{
parentTopic.setAttribute("order", order);
}
} }
} }
@ -213,7 +216,7 @@ mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem
} }
var order = domElem.getAttribute('order'); var order = domElem.getAttribute('order');
if (core.Utils.isDefined(order)) { if (core.Utils.isDefined(order) && !isNaN(order-0)) {
topic.setOrder(order); topic.setOrder(order);
} }

View File

@ -83,7 +83,10 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
// } else // } else
// { // {
var order = topic.getOrder(); var order = topic.getOrder();
parentTopic.setAttribute("order", order); if(core.Utils.isDefined(order) && !isNaN(order-0))
{
parentTopic.setAttribute("order", order);
}
// } // }
} }
@ -281,7 +284,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
} }
var order = domElem.getAttribute('order'); var order = domElem.getAttribute('order');
if (core.Utils.isDefined(order)) { if (core.Utils.isDefined(order) && !isNaN(order-0)) {
topic.setOrder(parseInt(order)); topic.setOrder(parseInt(order));
} }

View File

@ -13,7 +13,7 @@ import org.testng.annotations.Test;
import java.io.*; import java.io.*;
@Test @Test
public class ExportTest { public class FreemindExportTest {
private static final String DATA_DIR_PATH = "src/test/data/wisemaps/"; private static final String DATA_DIR_PATH = "src/test/data/wisemaps/";
@Test(dataProvider = "Data-Provider-Function") @Test(dataProvider = "Data-Provider-Function")
@ -85,7 +85,7 @@ public class ExportTest {
final File[] freeMindFiles = dataDir.listFiles(new FilenameFilter() { final File[] freeMindFiles = dataDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
return name.endsWith(".xml"); return name.endsWith(".wxml");
} }
}); });