X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=auto_tests%2Ftests%2FUtil.js;h=66daa7f2fb1dcff7847cc8a1829aea14cc28a92c;hb=3a84670d430444e0fb4b89c6991c3787f2f329dc;hp=7fca030a765695cc4470b528f38c4f9766d85556;hpb=846038aad4815feec55d2e86b8ccfad7dc1019b6;p=dygraphs.git diff --git a/auto_tests/tests/Util.js b/auto_tests/tests/Util.js index 7fca030..66daa7f 100644 --- a/auto_tests/tests/Util.js +++ b/auto_tests/tests/Util.js @@ -19,7 +19,7 @@ Util.getYLabels = function(axis_num, parent) { ary.push(y_labels[i].innerHTML); } return ary; -} +}; /** * Get the x-labels for a given axis. @@ -34,7 +34,7 @@ Util.getXLabels = function(parent) { ary.push(x_labels[i].innerHTML); } return ary; -} +}; /** * Returns all text in tags w/ a given css class, sorted. @@ -49,11 +49,20 @@ Util.getClassTexts = function(css_class, parent) { } texts.sort(); return texts; -} +}; Util.getLegend = function(parent) { parent = parent || document; var legend = parent.getElementsByClassName("dygraph-legend")[0]; return legend.textContent; -} +}; +/** + * Assert that all elements have a certain style property. + */ +Util.assertStyleOfChildren = function(selector, property, expectedValue) { + assertTrue(selector.length > 0); + $.each(selector, function(idx, child) { + assertEquals(expectedValue, $(child).css(property)); + }); +};