Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Makes sure Pie Charts correctly handle empty source data.
6 */
8 function test() {
9 initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
10 info("Starting test... ");
12 let { document, L10N, Chart } = aMonitor.panelWin;
13 let container = document.createElement("box");
15 let pie = Chart.Pie(document, {
16 data: [],
17 width: 100,
18 height: 100
19 });
21 let node = pie.node;
22 let slices = node.querySelectorAll(".pie-chart-slice.chart-colored-blob");
23 let labels = node.querySelectorAll(".pie-chart-label");
25 is(slices.length, 1,
26 "There should be 1 pie chart slice created.");
27 ok(slices[0].getAttribute("d").match(/\s*M 50,50 L 50\.\d+,2\.5\d* A 47\.5,47\.5 0 1 1 49\.\d+,2\.5\d* Z/),
28 "The slice has the correct data.");
30 ok(slices[0].hasAttribute("largest"),
31 "The slice should be the largest one.");
32 ok(slices[0].hasAttribute("smallest"),
33 "The slice should also be the smallest one.");
34 ok(slices[0].getAttribute("name"), L10N.getStr("pieChart.unavailable"),
35 "The slice's name is correct.");
37 is(labels.length, 1,
38 "There should be 1 pie chart label created.");
39 is(labels[0].textContent, "Empty",
40 "The label's text is correct.");
42 teardown(aMonitor).then(finish);
43 });
44 }