Cross Reference: /yui3/src/charts/tests/ariapietests.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>
/*Supplemental: CSS for the YUI distribution*/
#custom-doc { width: 95%; min-width: 950px; }
#pagetitle {background-image: url(/assets/bg_hd.gif);}
#mychart {
padding:10px 10px 10px 10px;
}
</style>
<link rel="stylesheet" type="text/css" href="/build/cssfonts/fonts-min.css">
</head>
<body class="yui3-skin-sam">
<h3>Aria Pie Tests</h3>
<div id="mychart"></div>
<script type="text/javascript" src="/build/yui/yui-min.js"></script>
<script>
YUI({
allowRollup: false,
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min'
}).use('charts', 'test', 'console', function (Y)
{
Y.namespace("example.test");
var suite = new Y.Test.Suite("Y.Charts.AriaPie"),
pieDataValues = [
{category:"5/1/2010", revenue:2200},
{category:"5/2/2010", revenue:100},
{category:"5/3/2010", revenue:1500},
{category:"5/4/2010", revenue:2800},
{category:"5/5/2010", revenue:2650}
],
defaultPieAriaDescription = "Use the left and right keys to navigate through items.",
width = 400,
height = 300;
function AriaTests(cfg, testConfig)
{
AriaTests.superclass.constructor.apply(this);
this.attrConfig = cfg;
this.name = testConfig.type + " Aria Tests";
this.defaultAriaDescription = testConfig.defaultAriaDescription;;
}
Y.extend(AriaTests, Y.Test.Case, {
defaultAriaLabel: "Chart Application",
changedAriaLabel: "This is a new ariaLabel value.",
setUp: function() {
var mychart = new Y.Chart(this.attrConfig);
this.chart = mychart;
},
tearDown: function() {
this.chart.destroy();
},
"test:getAriaLabel()": function()
{
Y.Assert.isTrue(this.chart.get("ariaLabel") == this.defaultAriaLabel);
},
"test:setAriaLabel()": function()
{
var chart = this.chart;
chart.set("ariaLabel", this.changedAriaLabel);
Y.Assert.isTrue(chart.get("ariaLabel") == this.changedAriaLabel);
},
"test:getAriaDescription()": function()
{
Y.Assert.isTrue(this.chart.get("ariaDescription") == this.defaultAriaDescription);
},
"test:setAriaDescription()": function()
{
var chart = this.chart;
chart.set("ariaDescription", this.changedAriaLabel);
Y.Assert.isTrue(chart.get("ariaDescription") == this.changedAriaLabel);
}
});
Y.AriaTests = AriaTests;
var pieTests = new Y.AriaTests({
dataProvider: pieDataValues,
render: "#mychart",
type: "pie",
width: width,
height: height
}, {
type: "Pie",
defaultAriaDescription: defaultPieAriaDescription
});
suite.add(pieTests);
//create the console
var r = new Y.Console({
newestOnTop : false,
style: 'block' // to anchor in the example content
});
r.render('#testLogger');
//run the tests
Y.Test.Runner.setName("Y.Charts.AriaPie");
Y.Test.Runner.add(suite);
Y.Test.Runner.run();
});
</script>
</body>
</html>