Skip to content

Commit

Permalink
fix reference error when devicePixelRatio is not defined. Closes #549
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Aug 23, 2012
1 parent 7d4becc commit 5b43314
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 4 additions & 3 deletions lib/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ function HTML(runner) {
, ctx

if (canvas.getContext) {
var ratio = window.devicePixelRatio || 1;
canvas.style.width = canvas.width;
canvas.style.height = canvas.height;
canvas.width *= devicePixelRatio;
canvas.height *= devicePixelRatio;
canvas.width *= ratio;
canvas.height *= ratio;
ctx = canvas.getContext('2d');
ctx.scale(devicePixelRatio, devicePixelRatio);
ctx.scale(ratio, ratio);
progress = new Progress;
}

Expand Down
11 changes: 5 additions & 6 deletions mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -1779,12 +1779,13 @@ function HTML(runner) {
, ctx

if (canvas.getContext) {
var ratio = window.devicePixelRatio || 1;
canvas.style.width = canvas.width;
canvas.style.height = canvas.height;
canvas.width *= devicePixelRatio;
canvas.height *= devicePixelRatio;
canvas.width *= ratio;
canvas.height *= ratio;
ctx = canvas.getContext('2d');
ctx.scale(devicePixelRatio, devicePixelRatio);
ctx.scale(ratio, ratio);
progress = new Progress;
}

Expand Down Expand Up @@ -4661,9 +4662,7 @@ window.mocha = require('mocha');
var Reporter = options.reporter || mocha.reporters.HTML;
var reporter = new Reporter(runner);
var query = parse(window.location.search || "");
console.log(query.grep);
console.log(decodeURIComponent(query.grep));
if (query.grep) runner.grep(new RegExp(decodeURIComponent(query.grep)));
if (query.grep) runner.grep(new RegExp(query.grep));
if (options.grep) runner.grep(options.grep);
if (options.ignoreLeaks) runner.ignoreLeaks = true;
if (options.globals) runner.globals(options.globals);
Expand Down

0 comments on commit 5b43314

Please sign in to comment.