Skip to content

Commit

Permalink
Mock object url functions for jsdom
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Mar 31, 2021
1 parent 9b94bee commit 61b152e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/imageviewer/test/widget.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ class LogImage extends ImageViewer {
}
}

// jsdom does not have createObjectURL and revokeObjectURL, so we define them.
function noOp () { }
if (typeof window.URL.createObjectURL === 'undefined') {
Object.defineProperty(window.URL, 'createObjectURL', { value: noOp})
Object.defineProperty(window.URL, 'revokeObjectURL', { value: noOp})
}

/**
* The common image model.
*/
Expand Down

0 comments on commit 61b152e

Please sign in to comment.