From: Robert Konigsberg Date: Mon, 31 Dec 2012 20:11:11 +0000 (-0500) Subject: Merge branch 'master' of github.com:kberg/dygraphs into axis-label-font-size X-Git-Tag: v1.0.0~132^2~5 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=7ff98630ca7cc2760e2115ad2372053184d3e717;p=dygraphs.git Merge branch 'master' of github.com:kberg/dygraphs into axis-label-font-size Conflicts: auto_tests/tests/axis_labels.js --- 7ff98630ca7cc2760e2115ad2372053184d3e717 diff --cc auto_tests/tests/Util.js index 66daa7f,3eb59e3..08cc88a --- a/auto_tests/tests/Util.js +++ b/auto_tests/tests/Util.js @@@ -58,11 -58,36 +58,23 @@@ Util.getLegend = function(parent) }; /** - * Assert that all the elements in 'parent' with class 'className' is - * the expected font size. + * Assert that all elements have a certain style property. */ -Util.assertFontSizes = function(parent, className, expectedSize) { - var expectedSizePx = expectedSize + "px"; - var labels = parent.getElementsByClassName(className); - assertTrue(labels.length > 0); - - // window.getComputedStyle is apparently compatible with all browsers - // (IE first became compatible with IE9.) - // If this test fails on earlier browsers, then enable something like this, - // because the font size is set by the parent div. - // if (!window.getComputedStyle) { - // fontSize = label.parentElement.style.fontSize; - // } - for (var idx = 0; idx < labels.length; idx++) { - var label = labels[idx]; - var fontSize = window.getComputedStyle(label).fontSize; - assertEquals(expectedSizePx, fontSize); - } +Util.assertStyleOfChildren = function(selector, property, expectedValue) { + assertTrue(selector.length > 0); + $.each(selector, function(idx, child) { + 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; + };