Skip to content

Commit a3c1e69

Browse files
fix: showing the number (#68)
1 parent 29079f5 commit a3c1e69

1 file changed

Lines changed: 27 additions & 8 deletions

File tree

main.mjs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ function buildTooltip(label, counts) {
2424
<h3 style="margin: 0;">${label}</h3>
2525
<div>Total: ${counts.total}</div>
2626
<div>Passing: ${counts.passing} (${formatPercentage(
27-
counts.passing / counts.total,
28-
)})</div>
27+
counts.passing / counts.total,
28+
)})</div>
2929
<div>Skipping: ${counts.skipping}</div>
3030
<div>Failing: ${counts.failing}</div>
3131
</div>
@@ -38,19 +38,24 @@ async function createMainChart(showAllTests = false) {
3838
);
3939
const entries = await response.json();
4040

41-
const chartData /*: [string, number, number, number, string, string, string][]*/ = [];
41+
const chartData /*: [string, number, number, number, string, string, string][]*/ =
42+
[];
4243
let prev = [];
4344

4445
for (const entry of entries.reverse()) {
4546
const { date, firefoxCounts, chromeCounts, chromeBidiOnlyCounts } = entry;
46-
if (prev[0] === chromeCounts.passing && prev[1] === firefoxCounts.passing
47-
&& prev[2] === chromeBidiOnlyCounts.passing) {
47+
if (
48+
prev[0] === chromeCounts.passing &&
49+
prev[1] === firefoxCounts.passing &&
50+
prev[2] === chromeBidiOnlyCounts.passing
51+
) {
4852
continue;
4953
}
5054
prev = [
5155
chromeCounts.passing,
5256
firefoxCounts.passing,
53-
chromeBidiOnlyCounts.passing];
57+
chromeBidiOnlyCounts.passing,
58+
];
5459

5560
chartData.push([
5661
new Date(date),
@@ -67,7 +72,7 @@ async function createMainChart(showAllTests = false) {
6772
),
6873
buildTooltip(
6974
'Chrome BiDi only ' + new Date(date).toLocaleDateString(),
70-
chromeBidiOnlyCounts,
75+
chromeBidiOnlyCounts,
7176
),
7277
]);
7378
if (new Date(date) < startDate) {
@@ -116,7 +121,7 @@ async function createMainChart(showAllTests = false) {
116121

117122
// `chartData` contains date, then percentage for each dataset, then
118123
// tooltip per each dataset.
119-
const tooltipOffset = (chartData[0].length-1) / 2 + 1;
124+
const tooltipOffset = (chartData[0].length - 1) / 2 + 1;
120125

121126
// Set Text
122127
if (tooltip.body) {
@@ -234,6 +239,20 @@ async function main() {
234239
});
235240
document.querySelector('#chrome-failing').textContent =
236241
chromeFailing.failing.length + chromeFailing.pending.length;
242+
const chromeBidiOnlyFailing = await fetch(
243+
allTests
244+
? './chromeBidiOnly-failing-all.json'
245+
: './chromeBidiOnly-failing.json',
246+
)
247+
.then((res) => res.json())
248+
.catch(() => {
249+
return {
250+
failing: [],
251+
pending: [],
252+
};
253+
});
254+
document.querySelector('#chromeBidiOnly-failing').textContent =
255+
chromeFailing.failing.length + chromeFailing.pending.length;
237256
}
238257

239258
main();

0 commit comments

Comments
 (0)