diff options
author | Richard Wall <richard@largo> | 2010-12-30 18:15:15 +0000 |
---|---|---|
committer | Richard Wall <richard@largo> | 2010-12-30 18:15:15 +0000 |
commit | cc1d4b25ed125afd07204da980f5c9bc555b7862 (patch) | |
tree | 530a62b6d16f955da3086a799190d60e9af765cb /jarmon/jarmon.test.js | |
parent | b3dfd26ce97cd1817f728667a586bf29eace752f (diff) |
Render an error message and a list of ds label fields
Diffstat (limited to 'jarmon/jarmon.test.js')
-rw-r--r-- | jarmon/jarmon.test.js | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/jarmon/jarmon.test.js b/jarmon/jarmon.test.js index 7f34391..0e548d5 100644 --- a/jarmon/jarmon.test.js +++ b/jarmon/jarmon.test.js @@ -403,13 +403,46 @@ YUI({ logInclude: { TestRunner: true } }).use('console', 'test', function(Y) { Y.Test.Runner.add(new Y.Test.Case({ name: "jarmon.ChartConfig", - test_draw: function () { + setUp: function() { + this.$tpl = $('<div/>').appendTo($('body')) + var c = new jarmon.ChartConfig(this.$tpl); + c.draw(); + }, + + test_drawInitialForm: function () { /** - * Test that a rendered chart has the correct dimensions, legend, - * axis, labels etc + * Test that the initial config form contains an rrd form field **/ - var c = new jarmon.ChartConfig($('<div/>').appendTo($('body'))); - c.draw(); + Y.Assert.areEqual( + this.$tpl.find('form input[name=rrd_url]').size(), 1); + }, + + test_drawUrlErrorMessage: function () { + /** + * Test that submitting the form with an incorrect url results in + * an error message + **/ + var self = this; + this.$tpl.find('form input[name=rrd_url]').val('Foo/Bar').submit(); + this.wait( + function() { + Y.Assert.areEqual(self.$tpl.find('.error').size(), 1); + }, 1000 + ); + }, + + test_drawUrlListDatasources: function () { + /** + * Test that submitting the form with an correct rrd url results in + * list of further DS label fields + **/ + var self = this; + this.$tpl.find('form input[name=rrd_url]').val('build/test.rrd').submit(); + this.wait( + function() { + Y.Assert.areEqual(self.$tpl.find('input[name=rrd_ds]').size(), 1); + }, 1000 + ); }, })); |