Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

fix HTML progress indicator retina display

TJ Holowaychuk6c9885787290
diff --git a/lib/reporters/html.js b/lib/reporters/html.js
index 85e0fcdf..3c33581b 100644
--- a/lib/reporters/html.js
+++ b/lib/reporters/html.js
@@ -63,7 +63,12 @@ function HTML(runner) {
, ctx
if (canvas.getContext) {
+ canvas.style.width = canvas.width;
+ canvas.style.height = canvas.height;
+ canvas.width *= devicePixelRatio;
+ canvas.height *= devicePixelRatio;
ctx = canvas.getContext('2d');
+ ctx.scale(devicePixelRatio, devicePixelRatio);
progress = new Progress;
}
diff --git a/mocha.js b/mocha.js
index 061ee3cf..f1098145 100644
--- a/mocha.js
+++ b/mocha.js
@@ -1732,7 +1732,12 @@ function HTML(runner) {
, ctx
if (canvas.getContext) {
+ canvas.style.width = canvas.width;
+ canvas.style.height = canvas.height;
+ canvas.width *= devicePixelRatio;
+ canvas.height *= devicePixelRatio;
ctx = canvas.getContext('2d');
+ ctx.scale(devicePixelRatio, devicePixelRatio);
progress = new Progress;
}
@@ -4429,7 +4434,7 @@ exports.clean = function(str) {
str = str.replace(re, '');
- return str.trim();
+ return exports.trim(str);
};
/**
@@ -4443,6 +4448,18 @@ exports.clean = function(str) {
exports.escapeRegexp = function(str){
return str.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&");
};
+
+/**
+ * Trim the given `str`.
+ *
+ * @param {String} str
+ * @return {String}
+ * @api private
+ */
+
+exports.trim = function(str){
+ return str.replace(/^\s+|\s+$/g, '');
+};
}); // module: utils.js
/**
* Node shims.