Browse files

Add refresh data for pie chart unit tests.

  • Loading branch information...
1 parent cbc4285 commit 5d30ee2d76dbc58df8d47bdefdc17e8edf3016dd @tripp committed Jul 27, 2012
Showing with 21 additions and 1 deletion.
  1. +21 −1 src/charts/tests/pie-tests.js
View
22 src/charts/tests/pie-tests.js
@@ -1,6 +1,16 @@
YUI.add('pie-tests', function(Y) {
var suite = new Y.Test.Suite("Y.Charts.Pie"),
+ newDataValues = [
+ {day:"Monday", taxes:200},
+ {day:"Tuesday", taxes:5000},
+ {day:"Wednesday", taxes:400},
+ {day:"Thursday", taxes:1200},
+ {day:"Friday", taxes:2000},
+ {day:"Saturday", taxes:1500},
+ {day:"Sunday", taxes:1800}
+ ],
+
//test to ensure that pie charts are drawn from center
//pie charts need to have the same width/height
PieCenterTest = new Y.Test.Case({
@@ -15,7 +25,7 @@ YUI.add('pie-tests', function(Y) {
{day:"Thursday", taxes:200},
{day:"Friday", taxes:2000}
];
- var mychart = new Y.Chart({type: "pie", width:400, height:400, dataProvider:myDataValues});
+ var mychart = new Y.Chart({type: "pie", categoryKey: "day", width:400, height:400, dataProvider:myDataValues});
mychart.render("#mychart");
this.chart = mychart;
},
@@ -75,6 +85,16 @@ YUI.add('pie-tests', function(Y) {
Y.assert(shape.get("width") === shape.get("height"));
}
}
+ },
+
+ testUpdateDataProvider: function()
+ {
+ var chart = this.chart,
+ graphic = chart.get("graph").get("graphic"),
+ shapes;
+ chart.set("dataProvider", newDataValues);
+ shapes = graphic.get("shapes");
+ Y.Assert.areEqual(7, Y.Object.size(shapes), "There should be seven pie slices.");
}
});

0 comments on commit 5d30ee2

Please sign in to comment.