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.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Makes sure Pie+Table Charts have the right internal structure. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | function test() { |
michael@0 | 9 | initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => { |
michael@0 | 10 | info("Starting test... "); |
michael@0 | 11 | |
michael@0 | 12 | let { document, L10N, Chart } = aMonitor.panelWin; |
michael@0 | 13 | let container = document.createElement("box"); |
michael@0 | 14 | |
michael@0 | 15 | let chart = Chart.PieTable(document, { |
michael@0 | 16 | title: "Table title", |
michael@0 | 17 | data: [{ |
michael@0 | 18 | size: 1, |
michael@0 | 19 | label: 11.1 |
michael@0 | 20 | }, { |
michael@0 | 21 | size: 2, |
michael@0 | 22 | label: 12.2 |
michael@0 | 23 | }, { |
michael@0 | 24 | size: 3, |
michael@0 | 25 | label: 13.3 |
michael@0 | 26 | }], |
michael@0 | 27 | strings: { |
michael@0 | 28 | label2: (value, index) => value + ["foo", "bar", "baz"][index] |
michael@0 | 29 | }, |
michael@0 | 30 | totals: { |
michael@0 | 31 | size: value => "Hello " + L10N.numberWithDecimals(value, 2), |
michael@0 | 32 | label: value => "World " + L10N.numberWithDecimals(value, 2) |
michael@0 | 33 | } |
michael@0 | 34 | }); |
michael@0 | 35 | |
michael@0 | 36 | ok(chart.pie, "The pie chart proxy is accessible."); |
michael@0 | 37 | ok(chart.table, "The table chart proxy is accessible."); |
michael@0 | 38 | |
michael@0 | 39 | let node = chart.node; |
michael@0 | 40 | let slices = node.querySelectorAll(".pie-chart-slice"); |
michael@0 | 41 | let rows = node.querySelectorAll(".table-chart-row"); |
michael@0 | 42 | let sums = node.querySelectorAll(".table-chart-summary-label"); |
michael@0 | 43 | |
michael@0 | 44 | ok(node.classList.contains("pie-table-chart-container"), |
michael@0 | 45 | "A pie+table chart container was created successfully."); |
michael@0 | 46 | |
michael@0 | 47 | ok(node.querySelector(".table-chart-title"), |
michael@0 | 48 | "A title node was created successfully."); |
michael@0 | 49 | ok(node.querySelector(".pie-chart-container"), |
michael@0 | 50 | "A pie chart was created successfully."); |
michael@0 | 51 | ok(node.querySelector(".table-chart-container"), |
michael@0 | 52 | "A table chart was created successfully."); |
michael@0 | 53 | |
michael@0 | 54 | is(rows.length, 3, |
michael@0 | 55 | "There should be 3 pie chart slices created."); |
michael@0 | 56 | is(rows.length, 3, |
michael@0 | 57 | "There should be 3 table chart rows created."); |
michael@0 | 58 | is(sums.length, 2, |
michael@0 | 59 | "There should be 2 total summaries created."); |
michael@0 | 60 | |
michael@0 | 61 | teardown(aMonitor).then(finish); |
michael@0 | 62 | }); |
michael@0 | 63 | } |