Skip to content

Commit

Permalink
Use global instead of window when in node.
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmageddon committed Feb 27, 2020
1 parent f30c782 commit caf2696
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/unit/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,19 +464,21 @@
});

QUnit.test('clone with namespace', function(assert) {
document.defaultView.Custom = {
var glob = fabric.isLikelyNode ? global : window;

glob.Custom = {
Object: fabric.util.createClass(fabric.Object, {
'namespace': 'Custom',
})
};

var cObj = new document.defaultView.Custom.Object();
var cObj = new glob.Custom.Object();

assert.ok(typeof cObj.clone === 'function');
cObj.clone(function(clone) {
assert.ok(clone instanceof document.defaultView.Custom.Object);
assert.ok(clone instanceof glob.Custom.Object);

delete document.defaultView.Custom;
delete glob.Custom;
});
});

Expand Down

0 comments on commit caf2696

Please sign in to comment.