Skip to content

Commit

Permalink
Fix bugs preventing progress text from being updated
Browse files Browse the repository at this point in the history
  • Loading branch information
yourWaifu authored Oct 12, 2023
1 parent 1876f4e commit 9504845
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ function HTML(runner, options) {
} else {
// On some broswers, canvas might be unavailable for whatever reason.
// As such, we need a text version as a fallback
var progressTextFallback = fragment('<em>0</em>%');
progressText = stat.getElementsByTagName('em')[0];
items[0].appendChild(progressTextFallback);
var progressTextFallback = fragment('<li class="progress">progress: <em>0</em>%</li>');
progressText = progressTextFallback.getElementsByTagName('em')[0];
items[0].replaceWith(progressTextFallback);
}

if (!root) {
Expand Down Expand Up @@ -248,7 +248,7 @@ function HTML(runner, options) {
// setting it too high, makes the progress text longer then it needs to
// to address this, calculate the toFixed based on the magnitude of total
var decmalPlaces = Math.ceil(Math.log10(runner.total/100));
text(progressText, percent.toFixed(Math.min(Math.max(decmalPlaces), 0), 100));
text(progressText, percent.toFixed(Math.min(Math.max(decmalPlaces, 0), 100)));
}

// update stats
Expand Down

0 comments on commit 9504845

Please sign in to comment.