Cross Reference: /yui3/src/charts/tests/ariahistogramtests.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp<html>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp <head>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp <meta http-equiv="content-type" content="text/html; charset=utf-8">
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp <style>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp /*Supplemental: CSS for the YUI distribution*/
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp #custom-doc { width: 95%; min-width: 950px; }
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp #pagetitle {background-image: url(/assets/bg_hd.gif);}
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp #mychart {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp padding:10px 10px 10px 10px;
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp }
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp </style>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp <link rel="stylesheet" type="text/css" href="/build/cssfonts/fonts-min.css">
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp </head>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp<body class="yui3-skin-sam">
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp<h3>Aria Histogram Tests</h3>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp<div id="mychart"></div>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp<script type="text/javascript" src="/build/yui/yui-min.js"></script>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp<script>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28TrippYUI({
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp allowRollup: false,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min'
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp}).use('charts', 'test', 'console', function (Y)
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp{
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp Y.namespace("example.test");
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp var suite = new Y.Test.Suite("Y.Charts.AriaHistogram"),
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp myDataValues = [
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {category:"5/1/2010", values:2000, expenses:3700, revenue:2200},
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {category:"5/2/2010", values:50, expenses:9100, revenue:100},
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {category:"5/3/2010", values:400, expenses:1100, revenue:1500},
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {category:"5/4/2010", values:200, expenses:1900, revenue:2800},
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {category:"5/5/2010", values:5000, expenses:5000, revenue:2650}
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp ],
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp pieDataValues = [
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {category:"5/1/2010", revenue:2200},
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {category:"5/2/2010", revenue:100},
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {category:"5/3/2010", revenue:1500},
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {category:"5/4/2010", revenue:2800},
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {category:"5/5/2010", revenue:2650}
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp ],
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp defaultAriaDescription = "Use the up and down keys to navigate between series. Use the left and right keys to navigate through items in a series.",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp defaultPieAriaDescription = "Use the left and right keys to navigate through items.",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp seriesKeys = ["values", "revenue"],
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp width = 400,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp height = 300;
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp function AriaTests(cfg, testConfig)
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp AriaTests.superclass.constructor.apply(this);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp this.attrConfig = cfg;
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp this.name = testConfig.type + " Aria Tests";
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp this.defaultAriaDescription = testConfig.defaultAriaDescription;;
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp }
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp Y.extend(AriaTests, Y.Test.Case, {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp defaultAriaLabel: "Chart Application",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp changedAriaLabel: "This is a new ariaLabel value.",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp setUp: function() {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp var mychart = new Y.Chart(this.attrConfig);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp this.chart = mychart;
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp },
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp tearDown: function() {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp this.chart.destroy();
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp },
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp "test:getAriaLabel()": function()
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp Y.Assert.isTrue(this.chart.get("ariaLabel") == this.defaultAriaLabel);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp },
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp "test:setAriaLabel()": function()
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp var chart = this.chart;
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp chart.set("ariaLabel", this.changedAriaLabel);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp Y.Assert.isTrue(chart.get("ariaLabel") == this.changedAriaLabel);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp },
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp "test:getAriaDescription()": function()
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp Y.Assert.isTrue(this.chart.get("ariaDescription") == this.defaultAriaDescription);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp },
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp "test:setAriaDescription()": function()
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp var chart = this.chart;
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp chart.set("ariaDescription", this.changedAriaLabel);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp Y.Assert.isTrue(chart.get("ariaDescription") == this.changedAriaLabel);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp }
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp });
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp Y.AriaTests = AriaTests;
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp var columnTests = new Y.AriaTests({
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp dataProvider: myDataValues,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp render: "#mychart",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp type: "column",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp width: width,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp height: height
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp }, {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp type: "Column",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp defaultAriaDescription: defaultAriaDescription
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp }),
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp stackedColumnTests = new Y.AriaTests({
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp dataProvider: myDataValues,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp render: "#mychart",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp type: "column",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp stacked: true,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp width: width,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp height: height
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp }, {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp type: "StackedColumn",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp defaultAriaDescription: defaultAriaDescription
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp }),
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp barTests = new Y.AriaTests({
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp dataProvider: myDataValues,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp render: "#mychart",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp type: "bar",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp width: width,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp height: height
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp }, {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp type: "Bar",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp defaultAriaDescription: defaultAriaDescription
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp }),
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp stackedBarTests = new Y.AriaTests({
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp dataProvider: myDataValues,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp render: "#mychart",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp type: "bar",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp stacked: true,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp width: width,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp height: height
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp }, {
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp type: "StackedBar",
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp defaultAriaDescription: defaultAriaDescription
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp });
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp suite.add(columnTests);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp suite.add(stackedColumnTests);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp suite.add(barTests);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp suite.add(stackedBarTests);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp //create the console
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp var r = new Y.Console({
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp newestOnTop : false,
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp style: 'block' // to anchor in the example content
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp });
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp r.render('#testLogger');
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp //run the tests
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp Y.Test.Runner.setName("Y.Charts.AriaHistogram");
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp Y.Test.Runner.add(suite);
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp Y.Test.Runner.run();
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp});
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp</script>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp</body>
4c307472e86c080e30ac5eb2ce60ab4f6fc10b28Tripp</html>