michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Makes sure Pie+Table Charts have the right internal structure. michael@0: */ michael@0: michael@0: function test() { michael@0: initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => { michael@0: info("Starting test... "); michael@0: michael@0: let { document, L10N, Chart } = aMonitor.panelWin; michael@0: let container = document.createElement("box"); michael@0: michael@0: let chart = Chart.PieTable(document, { michael@0: title: "Table title", michael@0: data: [{ michael@0: size: 1, michael@0: label: 11.1 michael@0: }, { michael@0: size: 2, michael@0: label: 12.2 michael@0: }, { michael@0: size: 3, michael@0: label: 13.3 michael@0: }], michael@0: strings: { michael@0: label2: (value, index) => value + ["foo", "bar", "baz"][index] michael@0: }, michael@0: totals: { michael@0: size: value => "Hello " + L10N.numberWithDecimals(value, 2), michael@0: label: value => "World " + L10N.numberWithDecimals(value, 2) michael@0: } michael@0: }); michael@0: michael@0: ok(chart.pie, "The pie chart proxy is accessible."); michael@0: ok(chart.table, "The table chart proxy is accessible."); michael@0: michael@0: let node = chart.node; michael@0: let slices = node.querySelectorAll(".pie-chart-slice"); michael@0: let rows = node.querySelectorAll(".table-chart-row"); michael@0: let sums = node.querySelectorAll(".table-chart-summary-label"); michael@0: michael@0: ok(node.classList.contains("pie-table-chart-container"), michael@0: "A pie+table chart container was created successfully."); michael@0: michael@0: ok(node.querySelector(".table-chart-title"), michael@0: "A title node was created successfully."); michael@0: ok(node.querySelector(".pie-chart-container"), michael@0: "A pie chart was created successfully."); michael@0: ok(node.querySelector(".table-chart-container"), michael@0: "A table chart was created successfully."); michael@0: michael@0: is(rows.length, 3, michael@0: "There should be 3 pie chart slices created."); michael@0: is(rows.length, 3, michael@0: "There should be 3 table chart rows created."); michael@0: is(sums.length, 2, michael@0: "There should be 2 total summaries created."); michael@0: michael@0: teardown(aMonitor).then(finish); michael@0: }); michael@0: }