summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wall <richard@largo>2010-10-04 00:27:06 +0100
committerRichard Wall <richard@largo>2010-10-04 00:27:06 +0100
commit9c71054a0e3f6e0bb5b524ada9b9c73ca90c2913 (patch)
tree9849f25d5fd981a2d324f71d4170e959898aab18
parente9b1a0b4728d9e74ae3c6dccbf037e07f36f5fd4 (diff)
A test case for the Chart class
-rw-r--r--jarmon/jarmon.test.js35
-rw-r--r--test.html7
2 files changed, 41 insertions, 1 deletions
diff --git a/jarmon/jarmon.test.js b/jarmon/jarmon.test.js
index 0ff1840..9ae7531 100644
--- a/jarmon/jarmon.test.js
+++ b/jarmon/jarmon.test.js
@@ -276,6 +276,41 @@ YUI({ logInclude: { TestRunner: true } }).use('console', 'test', function(Y) {
}));
+ Y.Test.Runner.add(new Y.Test.Case({
+ name: "jarmon.Chart",
+
+ XsetUp: function() {
+ this.d = new jarmon.downloadBinary('build/test.rrd')
+ .addCallback(
+ function(self, binary) {
+ return new RRDFile(binary);
+ }, this)
+ .addErrback(
+ function(ret) {
+ console.log(ret);
+ });
+ },
+
+ test_draw: function () {
+ /**
+ *
+ **/
+ var $tpl = $('<div><div class="chart"></div></div>').appendTo($('body'));
+ var c = new jarmon.Chart($tpl, {xaxis: {mode: "time"}});
+ //jarmon.Chart.BASE_OPTIONS
+ //c.options.xaxis.tzoffset = 0;
+ c.addData('speed', new jarmon.RrdQueryRemote('build/test.rrd', 'm/s'), true);
+ var d = c.setTimeRange(RRD_STARTTIME, RRD_ENDTIME);
+ d.addCallback(
+ function(self) {
+ self.resume(function() {
+ Y.Assert.areEqual(1, 1);
+ });
+ }, this);
+ this.wait();
+ },
+ }));
+
//initialize the console
var yconsole = new Y.Console({
diff --git a/test.html b/test.html
index 6db4f55..e8508f6 100644
--- a/test.html
+++ b/test.html
@@ -7,7 +7,12 @@
href="http://developer.yahoo.com/yui/3/assets/yui.css"/>
<link rel="stylesheet" type="text/css"
href="http://yui.yahooapis.com/3.1.1/build/cssfonts/fonts-min.css"/>
-
+ <style type='text/css'>
+ .chart {
+ width: 500px;
+ height: 100px;
+ }
+ </style>
<script src="http://yui.yahooapis.com/3.1.1/build/yui/yui-min.js"></script>
<script src="docs/examples/assets/js/dependencies.js"></script>
<script src="jarmon/jarmon.js"></script>