Commit 95b31038 authored by Michael Checo's avatar Michael Checo Committed by Commit Bot

Diagnostics: Rename percent_bar_chart title property to header

Bug: 1125150
Test: browser_tests --gtest_filter=DiagnosticsApp*
Change-Id: Ifea18890a5bc6144ae6a5581525d1495ff037a91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2453926Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Commit-Queue: Michael Checo <michaelcheco@google.com>
Cr-Commit-Position: refs/heads/master@{#814718}
parent b46eb6e7
...@@ -26,35 +26,36 @@ suite('PercentBarChartTest', () => { ...@@ -26,35 +26,36 @@ suite('PercentBarChartTest', () => {
}); });
/** /**
* @param {string} title * @param {string} header
* @param {number} value * @param {number} value
* @param {number} max * @param {number} max
*/ */
function initializePercentBarChart(title, value, max) { function initializePercentBarChart(header, value, max) {
assertFalse(!!percentBarChartElement); assertFalse(!!percentBarChartElement);
// Add the element to the DOM. // Add the element to the DOM.
percentBarChartElement = document.createElement('percent-bar-chart'); percentBarChartElement = document.createElement('percent-bar-chart');
assertTrue(!!percentBarChartElement); assertTrue(!!percentBarChartElement);
document.body.appendChild(percentBarChartElement); percentBarChartElement.header = header;
percentBarChartElement.title = title;
percentBarChartElement.value = value; percentBarChartElement.value = value;
percentBarChartElement.max = max; percentBarChartElement.max = max;
document.body.appendChild(percentBarChartElement);
return flushTasks(); return flushTasks();
} }
test('InitializePercentBarChart', () => { test('InitializePercentBarChart', () => {
const title = 'Test title'; const header = 'Test header';
const value = 10; const value = 10;
const max = 30; const max = 30;
const percent = Math.round(100 * value / max); const percent = Math.round(100 * value / max);
return initializePercentBarChart(title, value, max).then(() => { return initializePercentBarChart(header, value, max).then(() => {
const paperProgress = percentBarChartElement.$$('paper-progress'); const paperProgress = percentBarChartElement.$$('paper-progress');
assertEquals(value, paperProgress.value); assertEquals(value, paperProgress.value);
assertEquals(max, paperProgress.max); assertEquals(max, paperProgress.max);
assertEquals( assertEquals(
title, percentBarChartElement.$$('#chartName').textContent.trim()); header, percentBarChartElement.$$('#chartName').textContent.trim());
assertEquals( assertEquals(
`${percent}`, `${percent}`,
percentBarChartElement.$$('#percentageLabel').textContent.trim()); percentBarChartElement.$$('#percentageLabel').textContent.trim());
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<diagnostics-card> <diagnostics-card>
<div id="cardTitle" slot="title">[[i18n('batteryTitle')]]</div> <div id="cardTitle" slot="title">[[i18n('batteryTitle')]]</div>
<!-- TODO(joonbug): Localize once strings are confirmed --> <!-- TODO(joonbug): Localize once strings are confirmed -->
<percent-bar-chart slot="left-panel" title="Remaining charge" <percent-bar-chart slot="left-panel" header="Remaining charge"
value="[[batteryChargeStatus_.charge_now_milliamp_hours]]" value="[[batteryChargeStatus_.charge_now_milliamp_hours]]"
max="[[batteryChargeStatus_.charge_full_now_milliamp_hours]]"> max="[[batteryChargeStatus_.charge_full_now_milliamp_hours]]">
</percent-bar-chart> </percent-bar-chart>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<diagnostics-card> <diagnostics-card>
<div id="cardTitle" slot="title">[[i18n('memoryTitle')]]</div> <div id="cardTitle" slot="title">[[i18n('memoryTitle')]]</div>
<!-- TODO(joonbug): Localize once strings are confirmed --> <!-- TODO(joonbug): Localize once strings are confirmed -->
<percent-bar-chart slot="left-panel" title="Used memory" <percent-bar-chart slot="left-panel" header="Used memory"
value="[[getTotalUsedMemory_(memoryUsage_)]]" value="[[getTotalUsedMemory_(memoryUsage_)]]"
max="[[memoryUsage_.total_memory_kib]]"> max="[[memoryUsage_.total_memory_kib]]">
</percent-bar-chart> </percent-bar-chart>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</style> </style>
<div id="barChartContainer"> <div id="barChartContainer">
<label id="chartName">[[title]]</label> <label id="chartName">[[header]]</label>
<paper-progress id="barChart" value="[[value]]" max="[[max]]"></paper-progress> <paper-progress id="barChart" value="[[value]]" max="[[max]]"></paper-progress>
<!-- TODO(joonbug): Add i18n string for percent number format --> <!-- TODO(joonbug): Add i18n string for percent number format -->
<label id="percentageLabel">[[computePercentage_(value, max)]]</label> <label id="percentageLabel">[[computePercentage_(value, max)]]</label>
......
...@@ -19,7 +19,7 @@ Polymer({ ...@@ -19,7 +19,7 @@ Polymer({
_template: html`{__html_template__}`, _template: html`{__html_template__}`,
properties: { properties: {
title: { header: {
type: String, type: String,
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment