Skip to content

Commit

Permalink
Revert Favicon change
Browse files Browse the repository at this point in the history
  • Loading branch information
Amelia Magee committed Sep 11, 2024
1 parent 4a50a03 commit 70c9524
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/js/web/Notifications/FaviconEditorTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,21 @@ describe('FaviconEditor', () => {
faviconEditor = new FaviconEditor($root[0]);
faviconEditor.init();

canvas.toDataURL('image/png');
// Override serializer to return raw image data, we cannot use the default
// canvas.toDataURL(...) here as the png compression is different when
// in the browser / headless test environments
faviconEditor.setSerializer((canvas, ctx) => {
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const debugCvs = document.createElement('canvas');
const debugCtx = debugCvs.getContext('2d');

debugCtx.width = canvas.width;
debugCtx.height = canvas.height;
debugCtx.putImageData(imageData, 0, 0);
actual = debugCvs.toDataURL('image/png');

return [...imageData.data];
});

faviconEditor.addCircleNotification('red', 5)
.then((data) => {
Expand Down

0 comments on commit 70c9524

Please sign in to comment.