Skip to content

Commit

Permalink
ssr test
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Jan 31, 2023
1 parent 6761606 commit 1278696
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/unit/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
QUnit.module('env', (hooks) => {
QUnit[fabric.getEnv().isLikelyNode ? 'test' : 'skip']('SSR: importing fabric before window/document are defined', async assert => {
const done = assert.async();
const fabric = require('../..');
global.window = { devicePixelRatio: 1.25 };
global.document = { foo: 'bar' };
assert.deepEqual(fabric.getEnv(), {
document: { foo: 'bar' },
window: { devicePixelRatio: 1.25 },
isTouchSupported: undefined,
isLikelyNode: false,
copyPasteData: {}
}, 'env should match');
delete global.window;
delete global.document;
done();
});
})

0 comments on commit 1278696

Please sign in to comment.