Index: tracing/tracing/ui/base/bar_chart_test.html |
diff --git a/tracing/tracing/ui/base/bar_chart_test.html b/tracing/tracing/ui/base/bar_chart_test.html |
index 24d9de51dc2dbe9fac7fededa04191b0c7123633..157b20232f1565709f10c4d473bcaf87df7120ad 100644 |
--- a/tracing/tracing/ui/base/bar_chart_test.html |
+++ b/tracing/tracing/ui/base/bar_chart_test.html |
@@ -6,11 +6,63 @@ found in the LICENSE file. |
--> |
<link rel="import" href="/tracing/ui/base/bar_chart.html"> |
+<link rel="import" href="/tracing/ui/base/deep_utils.html"> |
<script> |
'use strict'; |
tr.b.unittest.testSuite(function() { |
+ test('chartLegendKey', function() { |
+ var key = document.createElement('tr-ui-b-chart-legend-key'); |
+ key.textContent = 'Lorem ipsum dolor sit amet'; |
+ key.color = 'red'; |
+ this.addHTMLOutput(key); |
+ |
+ key = document.createElement('tr-ui-b-chart-legend-key'); |
+ key.textContent = 'ipsum dolor sit amet'; |
+ key.target = 'orange ipsum'; |
+ key.color = 'orange'; |
+ this.addHTMLOutput(key); |
+ key.addEventListener('requestSelectionChange', function(e) { |
+ console.debug(e); |
+ }); |
+ |
+ key = document.createElement('tr-ui-b-chart-legend-key'); |
+ key.target = 'brown dolor'; |
+ key.color = 'brown'; |
+ key.textContent = 'dolor sit amet'; |
+ this.addHTMLOutput(key); |
+ key.addEventListener('requestSelectionChange', function(e) { |
+ console.debug(e); |
+ }); |
+ }); |
+ |
+ test('instantiation_legendTargets', function() { |
+ var chart = new tr.ui.b.BarChart(); |
+ chart.customizeLegendTargets({ |
+ lorem_ipsum: 'lorem_ipsumTarget', |
+ qux: 'quxTarget' |
+ }); |
+ chart.customizeOptionalSeries({lorem_ipsum: true, bar: true}); |
+ chart.isStacked = true; |
+ chart.hideXAxis = true; |
+ chart.width = 140; |
+ chart.height = 200; |
+ chart.chartTitle = 'title'; |
+ chart.data = [{x: 0, foo: 3, lorem_ipsum: 5, bar: 1, qux: 2}]; |
+ this.addHTMLOutput(chart); |
+ chart.addEventListener('requestSelectionChange', function(e) { |
+ console.debug(e); |
+ }); |
+ |
+ assert.isDefined(tr.b.findDeepElementMatchingPredicate( |
+ chart, function(element) { |
+ return element.tagName === 'TR-UI-B-CHART-LEGEND-KEY' && |
+ element.textContent === 'lorem_ipsum' && |
+ element.target === 'lorem_ipsumTarget'; |
+ })); |
+ }); |
+ |
test('instantiation_singleSeries', function() { |
var chart = new tr.ui.b.BarChart(); |
chart.width = 400; |
@@ -26,6 +78,34 @@ tr.b.unittest.testSuite(function() { |
this.addHTMLOutput(chart); |
}); |
+ test('instantiation_singleDatum', function() { |
+ var chart = new tr.ui.b.BarChart(); |
+ chart.width = 400; |
+ chart.height = 200; |
+ chart.chartTitle = 'Chart title'; |
+ var data = [ |
+ {x: 0, value: 100}, |
+ ]; |
+ chart.data = data; |
+ this.addHTMLOutput(chart); |
+ }); |
+ |
+ test('instantiation_stacked', function() { |
+ var chart = new tr.ui.b.BarChart(); |
+ chart.isStacked = true; |
+ chart.width = 400; |
+ chart.height = 200; |
+ chart.chartTitle = 'title'; |
+ var data = [ |
+ {x: 10, foo: 10, bar: 5, qux: 7}, |
+ {x: 20, foo: 11, bar: 6, qux: 3}, |
+ {x: 30, foo: 10, bar: 4, qux: 8}, |
+ {x: 40, foo: 5, bar: 1, qux: 2} |
+ ]; |
+ chart.data = data; |
+ this.addHTMLOutput(chart); |
+ }); |
+ |
test('instantiation_singleSeries_yLogScale', function() { |
var chart = new tr.ui.b.BarChart(); |
chart.isYLogScale = true; |