fix tests

pull/21833/head
Bruno Windels 2020-04-28 10:41:35 +02:00
parent 76e04fbdfa
commit 19fc6a93ec
1 changed files with 4 additions and 0 deletions

View File

@ -59,6 +59,10 @@ function urlForColor(color) {
canvas.width = size;
canvas.height = size;
const ctx = canvas.getContext("2d");
// bail out when using jsdom in unit tests
if (!ctx) {
return "";
}
ctx.fillStyle = color;
ctx.fillRect(0, 0, size, size);
return canvas.toDataURL();