Skip to content

Commit 9504845

Browse files
authoredOct 12, 2023
Fix bugs preventing progress text from being updated
1 parent 1876f4e commit 9504845

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎lib/reporters/html.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ function HTML(runner, options) {
8888
} else {
8989
// On some broswers, canvas might be unavailable for whatever reason.
9090
// As such, we need a text version as a fallback
91-
var progressTextFallback = fragment('<em>0</em>%');
92-
progressText = stat.getElementsByTagName('em')[0];
93-
items[0].appendChild(progressTextFallback);
91+
var progressTextFallback = fragment('<li class="progress">progress: <em>0</em>%</li>');
92+
progressText = progressTextFallback.getElementsByTagName('em')[0];
93+
items[0].replaceWith(progressTextFallback);
9494
}
9595

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

254254
// update stats

0 commit comments

Comments
 (0)