From 9504845ae22d8eae960daaa5ce513e40bf4d07b7 Mon Sep 17 00:00:00 2001 From: Sleepy Flower Date: Thu, 12 Oct 2023 18:46:23 -0400 Subject: [PATCH] Fix bugs preventing progress text from being updated --- lib/reporters/html.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/reporters/html.js b/lib/reporters/html.js index 0472e5b733..c32a8f300c 100644 --- a/lib/reporters/html.js +++ b/lib/reporters/html.js @@ -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('0%'); - progressText = stat.getElementsByTagName('em')[0]; - items[0].appendChild(progressTextFallback); + var progressTextFallback = fragment('
  • progress: 0%
  • '); + progressText = progressTextFallback.getElementsByTagName('em')[0]; + items[0].replaceWith(progressTextFallback); } if (!root) { @@ -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