Add CSS "reset" to fix Issue 429
[dygraphs.git] / auto_tests / tests / Util.js
index 66daa7f..2b308b3 100644 (file)
@@ -54,7 +54,8 @@ Util.getClassTexts = function(css_class, parent) {
 Util.getLegend = function(parent) {
   parent = parent || document;
   var legend = parent.getElementsByClassName("dygraph-legend")[0];
-  return legend.textContent;
+  var re = new RegExp(String.fromCharCode(160), 'g');
+  return legend.textContent.replace(re, ' ');
 };
 
 /**
@@ -66,3 +67,15 @@ Util.assertStyleOfChildren = function(selector, property, expectedValue) {
     assertEquals(expectedValue,  $(child).css(property));
   });
 };
+
+
+/**
+ * Takes in an array of strings and returns an array of floats.
+ */
+Util.makeNumbers = function(ary) {
+  var ret = [];
+  for (var i = 0; i < ary.length; i++) {
+    ret.push(parseFloat(ary[i]));
+  }
+  return ret;
+};