2019-02-27 08:06:04 -05:00
|
|
|
function equal(val1, val2, message) {
|
|
|
|
if (val1 !== val2) {
|
|
|
|
throw new Error('Not passed: ' + message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// try to import only core
|
2019-02-27 17:30:47 -05:00
|
|
|
let Konva = require('../lib/Core');
|
2019-02-27 08:06:04 -05:00
|
|
|
|
|
|
|
// no external shapes
|
|
|
|
equal(Konva.Rect, undefined, 'no external shapes');
|
|
|
|
|
|
|
|
let Rect = require('../lib/shapes/Rect').Rect;
|
|
|
|
|
|
|
|
equal(Rect !== undefined, true, 'Rect is defined');
|
2019-03-06 22:19:32 -05:00
|
|
|
equal(Konva.Rect, Rect, 'Rect is injected');
|
2019-02-27 08:06:04 -05:00
|
|
|
|
|
|
|
// now import from package.json
|
2019-02-27 17:30:47 -05:00
|
|
|
let NewKonva = require('../');
|
2019-02-27 08:06:04 -05:00
|
|
|
|
|
|
|
equal(NewKonva.Rect, Rect, 'Same rects');
|
2019-02-27 11:18:21 -05:00
|
|
|
|
|
|
|
// check global injection
|
|
|
|
equal(global.Konva, NewKonva, 'injected');
|
2019-03-06 22:19:32 -05:00
|
|
|
|
|
|
|
equal(NewKonva, Konva, 'Full package is the same as core.');
|